Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug fixes for getAdvance1, getAdvance2 & secondary tables. #1155

Merged
merged 18 commits into from
Jan 9, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions reference/speeduino.ini
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,12 @@

#define loadSourceNames = "MAP", "TPS", "IMAP/EMAP", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID"
#define loadSourceUnits = "kPa", "% TPS", "%", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID"

algorithmNames = bits, U08, [0:2], $loadSourceNames
algorithmUnits = bits, U08, [0:2], "kPa", "% TPS", "%", "% TPS", "INVALID", "INVALID", "INVALID", "INVALID"
algorithmLimits = array, U16, [8], "", 1.0, 0, 0, 511, 0, noMsqSave
fuel2SwitchUnits = bits, U08, [0:2], "rpm", "kPa", "% TPS", "%", "% TPS", "INVALID", "INVALID", "INVALID"
spark2ModeUnits = bits, U08, [0:2], "", "%", "deg", "deg", "deg","INVALID","INVALID","INVALID"

;All definitions of split fullStatus should keep 32 options
#define fullStatus_def_1= "seconds", "status bits", "Engine status", "syncLossCounter", "MAP (Kpa)", "INVALID", "IAT / MAT", "coolant", "batCorrection", "battery voltage x10", "O2", "egoCorrection", "iatCorrection", "wueCorrection", "RPM", "INVALID", "AEamount/2", "GammaE", "INVALID", "VE1", "VE2", "AFR Target", "TPS DOT", "INVALID", "Advance", "TPS", "loopsPerSecond", "INVALID", "free RAM", "INVALID", "boostTarget/2", "Boost duty"
Expand Down Expand Up @@ -5160,9 +5162,9 @@ cmdVSSratio6 = "E\x99\x06"
baroCorrectGauge = baroCorrection,"Baro Correction", "%", 0, 200, 130, 140, 140, 150, 0, 0
flexEnrich = flexFuelCor, "Flex Correction", "%", 0, 200, 130, 140, 140, 150, 0, 0
fuelTempCorGauge = fuelTempCor, "Fuel Temp Correction", "%", 0, 200, 130, 140, 140, 150, 0, 0
advanceGauge = advance, "Advance (Current)", "deg", 50, -10, 0, 0, 35, 45, 0, 0
advance1Gauge = advance1, "Advance1 (Spark Table 1)", "deg",50, -10, 0, 0, 35, 45, 0, 0
advance2Gauge = advance2, "Advance2 (Spark Table 2)", "deg",50, -10, 0, 0, 35, 45, 0, 0
advanceGauge = advance, "Advance (Current)", "deg", -10, 50, 0, 0, 35, 45, 0, 0
advance1Gauge = advance1, "Advance1 (Spark Table 1)", "deg",-10, 50, 0, 0, 35, 45, 0, 0
advance2Gauge = advance2ForGauge, "Advance2 (Spark Table 2)", { bitStringValue( spark2ModeUnits, spark2Mode ) }, { ign2ValuesMin }, { ign2ValuesMax }, { ign2ValueLoD }, { ign2ValueLoW }, { ign2ValueHiW }, { ign2ValueHiD }, 0, 0
dwellGauge = dwell, "Dwell (Requested)", "mSec", 0, 35.0, 1.0, 1.2, 20, 25, 3, 3
dwellActualGauge = dwellActual, "Dwell (Measured)", "mSec", 0, 35.0, 1.0, 1.2, 20, 25, 3, 3
boostTargetGauge = boostTarget, "Target Boost", "kPa", 0, {maphigh}, 0, 20, {mapwarn}, {mapdang}, 0, 0
Expand Down Expand Up @@ -5566,6 +5568,12 @@ cmdVSSratio6 = "E\x99\x06"
ign2LoadMax = { (spark2Algorithm == 0 || spark2Algorithm == 2) ? 511 : 100.0 }
ign2ValuesMin = { (spark2Mode == 1) ? 0 : -40 }
ign2ValuesMax = { (spark2Mode == 1) ? 215 : 70 }
; We have to pass a U08 through a S08 in multiply mode
advance2ForGauge = { (spark2Mode == 1) ? advance2+127 : advance2 }
ign2ValueLoD = { (spark2Mode == 1) ? ign2ValuesMin : (ign2ValuesMin/10)*9 }
ign2ValueHiD = { (spark2Mode == 1) ? ign2ValuesMax : (ign2ValuesMax/10)*9 }
ign2ValueLoW = { (spark2Mode == 1) ? ign2ValuesMin : (ign2ValuesMin/10)*8 }
ign2ValueHiW = { (spark2Mode == 1) ? ign2ValuesMax : (ign2ValuesMax/10)*8 }

fuelLoad2 = { fuel2Algorithm == 0 ? map : fuel2Algorithm == 1 ? tps : fuel2Algorithm == 2 ? 0 : 0 }
ignLoad2 = { spark2Algorithm == 0 ? map : spark2Algorithm == 1 ? tps : spark2Algorithm == 2 ? 0 : ignLoad }
Expand Down
21 changes: 21 additions & 0 deletions speeduino/bit_manip.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#pragma once

/**
* @file
* @brief Bit twiddling macros
*/

/** @brief Set bit b (0-7) in byte a */
#define BIT_SET(var,pos) ((var) |= (1U<<(pos)))

/** @brief Clear bit b (0-7) in byte a */
#define BIT_CLEAR(var,pos) ((var) &= ~(1U<<(pos)))

/** @brief Is bit pos (0-7) in byte var set? */
#define BIT_CHECK(var,pos) !!((var) & (1U<<(pos)))

/** @brief Toggle the value of bit pos (0-7) in byte var */
#define BIT_TOGGLE(var,pos) ((var)^= 1UL << (pos))

/** @brief Set the value ([0,1], [true, false]) of bit pos (0-7) in byte var */
#define BIT_WRITE(var, pos, bitvalue) ((bitvalue) ? BIT_SET((var), (pos)) : BIT_CLEAR((var), (pos)))
Loading
Loading