Skip to content

Commit

Permalink
Merge branch 'master' into newparse
Browse files Browse the repository at this point in the history
  • Loading branch information
mck1117 committed Jul 18, 2023
2 parents 3d941ab + c36840d commit e793519
Show file tree
Hide file tree
Showing 14 changed files with 67 additions and 142 deletions.
14 changes: 7 additions & 7 deletions firmware/controllers/actuators/boost_control.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ bit rpmTooLow
bit tpsTooLow
bit mapTooLow

int16_t autoscale luaTargetAdd;"Boost: Lua target add";"v", 0.5,0, -100,100, 1, @@GAUGE_CATEGORY_BOOST_CONTROL@@
int16_t autoscale boostOutput;@@GAUGE_NAME_BOOST_OUTPUT@@;"percent", 0.01,0, -100,100, 2, @@GAUGE_CATEGORY_BOOST_CONTROL@@
float luaTargetMult;"Boost: Lua target mult";"v", 1,0, -100,100, 1, @@GAUGE_CATEGORY_BOOST_CONTROL@@
int16_t autoscale luaTargetAdd;"Boost: Lua target add";"v", 0.5,0, -100,100, 1
int16_t autoscale boostOutput;@@GAUGE_NAME_BOOST_OUTPUT@@;"percent", 0.01,0, -100,100, 2
float luaTargetMult;"Boost: Lua target mult";"v", 1,0, -100,100, 1

float openLoopPart;@@GAUGE_NAME_BOOST_OPEN_LOOP@@;"v", 1,0, -100,100, 1, @@GAUGE_CATEGORY_BOOST_CONTROL@@
float luaOpenLoopAdd;"Boost: Lua open loop add";"v", 1,0, -100,100, 1, @@GAUGE_CATEGORY_BOOST_CONTROL@@
int8_t autoscale boostControllerClosedLoopPart;@@GAUGE_NAME_BOOST_CLOSED_LOOP@@;"%", 0.5,0, -50,50, 1, @@GAUGE_CATEGORY_BOOST_CONTROL@@
int16_t autoscale boostControlTarget;@@GAUGE_NAME_BOOST_TARGET@@;"kPa",{1/@@PACK_MULT_PRESSURE@@},0, 0, 300, 1, @@GAUGE_CATEGORY_BOOST_CONTROL@@
float openLoopPart;@@GAUGE_NAME_BOOST_OPEN_LOOP@@;"v", 1,0, -100,100, 1
float luaOpenLoopAdd;"Boost: Lua open loop add";"v", 1,0, -100,100, 1
int8_t autoscale boostControllerClosedLoopPart;@@GAUGE_NAME_BOOST_CLOSED_LOOP@@;"%", 0.5,0, -50,50, 1
int16_t autoscale boostControlTarget;@@GAUGE_NAME_BOOST_TARGET@@;"kPa",{1/@@PACK_MULT_PRESSURE@@},0, 0, 300, 1


end_struct
4 changes: 2 additions & 2 deletions firmware/controllers/actuators/dc_motors.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
! units,scale,offset,min,max,digits

struct_no_prefix dc_motors_s
float dcOutput0;"DC: output0";"per", 1,0, 0,10, 2,@@GAUGE_CATEGORY_ETB@@
uint8_t isEnabled0_int;"DC: en0";"per", 1,0, 0,10, 2,@@GAUGE_CATEGORY_ETB@@
float dcOutput0;"DC: output0";"per", 1,0, 0,10, 2
uint8_t isEnabled0_int;"DC: en0";"per", 1,0, 0,10, 2
bit isEnabled0

end_struct
14 changes: 7 additions & 7 deletions firmware/controllers/actuators/electronic_throttle.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
! units,scale,offset,min,max,digits

struct_no_prefix electronic_throttle_s
float idlePosition;"ETB: idlePosition";"per", 1,0, 0,10, 2,@@GAUGE_CATEGORY_ETB@@
float idlePosition;"ETB: idlePosition";"per", 1,0, 0,10, 2
float trim;"ETB: trim"
float luaAdjustment;"ETB: luaAdjustment";"per", 1,0, 0,3, 2,@@GAUGE_CATEGORY_ETB@@
float luaAdjustment;"ETB: luaAdjustment";"per", 1,0, 0,3, 2

float m_wastegatePosition;"DC: wastegatePosition";"per", 1,0, 0,3, 2,@@GAUGE_CATEGORY_ETB@@
float m_wastegatePosition;"DC: wastegatePosition";"per", 1,0, 0,3, 2


custom percent_t 4 scalar, F32, @OFFSET@, "", 1, 0, 0, 100, 2
Expand All @@ -18,10 +18,10 @@ struct_no_prefix electronic_throttle_s
bit etbRevLimitActive
bit jamDetected

float etbDutyRateOfChange;"ETB duty rate of change";"per", 1,0, -0,20, 2,@@GAUGE_CATEGORY_ETB@@
float etbDutyAverage;"ETB average duty";"per", 1,0, -20,50, 2,@@GAUGE_CATEGORY_ETB@@
uint16_t etbTpsErrorCounter;"ETB TPS error counter";"count", 1,0, 0,3, 0,@@GAUGE_CATEGORY_ETB@@
uint16_t etbPpsErrorCounter;"ETB pedal error counter";"count", 1,0, 0,3, 0,@@GAUGE_CATEGORY_ETB@@
float etbDutyRateOfChange;"ETB duty rate of change";"per", 1,0, -0,20, 2
float etbDutyAverage;"ETB average duty";"per", 1,0, -20,50, 2
uint16_t etbTpsErrorCounter;"ETB TPS error counter";"count", 1,0, 0,3, 0
uint16_t etbPpsErrorCounter;"ETB pedal error counter";"count", 1,0, 0,3, 0

int8_t etbErrorCode

Expand Down
8 changes: 4 additions & 4 deletions firmware/controllers/algo/fuel/fuel_computer.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
struct_no_prefix fuel_computer_s

float totalFuelCorrection;Fuel: Total correction;"mult", 1,0, 0,3, 2,@@GAUGE_CATEGORY_FUEL_MATH@@
float totalFuelCorrection;Fuel: Total correction;"mult", 1,0, 0,3, 2
struct running_fuel_s
float postCrankingFuelCorrection;Fuel: Post cranking mult
float intakeTemperatureCoefficient;@@GAUGE_NAME_FUEL_IAT_CORR@@
float coolantTemperatureCoefficient;@@GAUGE_NAME_FUEL_CLT_CORR@@
float timeSinceCrankingInSecs;;"secs", 1,0, 0,600000, 0, @@GAUGE_CATEGORY_FUEL_MATH@@
float timeSinceCrankingInSecs;;"secs", 1,0, 0,600000, 0

uint16_t autoscale baseFuel;@@GAUGE_NAME_FUEL_BASE@@\nThis is the raw value we take from the fuel map or base fuel algorithm, before the corrections;"mg",{1/@@PACK_MULT_FUEL_MASS@@}, 0, 0, 0, 3
uint16_t autoscale fuel;@@GAUGE_NAME_FUEL_RUNNING@@\nTotal fuel with CLT IAT and TPS acceleration without injector lag corrections per cycle, as pulse per cycle;"mg",{1/@@PACK_MULT_FUEL_MASS@@}, 0, 0, 0, 3
Expand All @@ -16,8 +16,8 @@ struct_no_prefix fuel_computer_s
running_fuel_s running

uint16_t autoscale afrTableYAxis;;"%",{1/100},0, 0, 0, 0
uint16_t autoscale targetLambda;@@GAUGE_NAME_TARGET_LAMBDA@@;"",{1/@@PACK_MULT_LAMBDA@@},0, 0.5,1.5, 2,@@GAUGE_CATEGORY_FUEL_MATH@@
uint16_t autoscale targetAFR;@@GAUGE_NAME_TARGET_AFR@@;"ratio", {1/@@PACK_MULT_AFR@@},0, 10,20, 2,@@GAUGE_CATEGORY_FUEL_MATH@@
uint16_t autoscale targetLambda;@@GAUGE_NAME_TARGET_LAMBDA@@;"",{1/@@PACK_MULT_LAMBDA@@},0, 0.5,1.5, 2
uint16_t autoscale targetAFR;@@GAUGE_NAME_TARGET_AFR@@;"ratio", {1/@@PACK_MULT_AFR@@},0, 10,20, 2

uint16_t autoscale stoichiometricRatio;Fuel: Stoich ratio;"ratio",{1/@@PACK_MULT_AFR@@}, 0, 0, 0, 2

Expand Down
16 changes: 8 additions & 8 deletions firmware/controllers/algo/ignition_state.txt
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
! "units",scale,offset, min,max, digits,category

struct_no_prefix ignition_state_s
float baseDwell;;"ms", 1,0, 0,30, 1,@@GAUGE_CATEGORY_TIMING@@
floatms_t sparkDwell;@@GAUGE_COIL_DWELL_TIME@@;"ms", 1,0, 0,30, 1,@@GAUGE_CATEGORY_TIMING@@
float baseDwell;;"ms", 1,0, 0,30, 1
floatms_t sparkDwell;@@GAUGE_COIL_DWELL_TIME@@;"ms", 1,0, 0,30, 1

angle_t dwellAngle;ignition dwell duration\nas crankshaft angle\nNAN if engine is stopped\nSee also sparkDwell;"deg", 1,0, 0,120, 1,@@GAUGE_CATEGORY_TIMING@@
angle_t dwellAngle;ignition dwell duration\nas crankshaft angle\nNAN if engine is stopped\nSee also sparkDwell;"deg", 1,0, 0,120, 1

int16_t autoscale cltTimingCorrection;Ign: CLT correction;"deg",{1/@@PACK_MULT_PERCENT@@},0, -20,20, 2,@@GAUGE_CATEGORY_TIMING@@
int16_t autoscale timingIatCorrection;Ign: IAT correction;"deg",{1/@@PACK_MULT_PERCENT@@},0, -20,20, 2,@@GAUGE_CATEGORY_TIMING@@
int16_t autoscale timingPidCorrection;Idle: Timing adjustment;"deg",{1/@@PACK_MULT_PERCENT@@},0, -20,20, 2,@@GAUGE_CATEGORY_TIMING@@
int16_t autoscale cltTimingCorrection;Ign: CLT correction;"deg",{1/@@PACK_MULT_PERCENT@@},0, -20,20, 2
int16_t autoscale timingIatCorrection;Ign: IAT correction;"deg",{1/@@PACK_MULT_PERCENT@@},0, -20,20, 2
int16_t autoscale timingPidCorrection;Idle: Timing adjustment;"deg",{1/@@PACK_MULT_PERCENT@@},0, -20,20, 2


float dwellVoltageCorrection;Ign: Dwell voltage correction

float luaTimingAdd;Ign: Lua timing add;"deg",1, 0, -20, 20, 2, @@GAUGE_CATEGORY_TIMING@@
float luaTimingMult;Ign: Lua timing mult;"deg",1, 0, -20, 20, 2, @@GAUGE_CATEGORY_TIMING@@
float luaTimingAdd;Ign: Lua timing add;"deg",1, 0, -20, 20, 2
float luaTimingMult;Ign: Lua timing mult;"deg",1, 0, -20, 20, 2

end_struct

6 changes: 3 additions & 3 deletions firmware/controllers/sensors/sent_state.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
struct sent_state_s
uint16_t value0;"ETB: SENT value0";"value", 1,0, 0,3, 0,@@GAUGE_CATEGORY_ETB@@
uint16_t value1;"ETB: SENT value1";"value", 1,0, 0,3, 0,@@GAUGE_CATEGORY_ETB@@
float errorRate;"ETB: SENT error rate";"ratio", 1,0, 0,3, 2,@@GAUGE_CATEGORY_ETB@@
uint16_t value0;"ETB: SENT value0";"value", 1,0, 0,3, 0
uint16_t value1;"ETB: SENT value1";"value", 1,0, 0,3, 0
float errorRate;"ETB: SENT error rate";"ratio", 1,0, 0,3, 2
end_struct
1 change: 0 additions & 1 deletion firmware/gen_config_common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ COMMON_GEN_CONFIG="
-readfile DATALOG_SECTION_FROM_FILE console/binary/generated/data_logs.ini \
-readfile LIVE_DATA_MENU_FROM_FILE console/binary/generated/fancy_menu.ini \
-readfile LIVE_DATA_PANELS_FROM_FILE console/binary/generated/fancy_content.ini \
-readfile LIVE_DATA_GAUGES_FROM_FILE console/binary/generated/gauges.ini \
-ts_destination tunerstudio \
-firing_order controllers/algo/firing_order.h \
-triggerInputFolder ../unit_tests \
Expand Down
3 changes: 0 additions & 3 deletions firmware/integration/rusefi_config_shared.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,6 @@
#define GAUGE_NAME_TRG_ERR "Trigger Error Counter"
#define GAUGE_NAME_TRG_GAP "Trigger Sync Latest Ratio"

#define GAUGE_CATEGORY_TIMING "Timing"
#define GAUGE_CATEGORY_FUEL_MATH "Fuel: math"
#define GAUGE_CATEGORY_BOOST_CONTROL "Boost Control"
#define GAUGE_CATEGORY_ETB "ETB more"

#define GAUGE_NAME_VVT_B1I "VVT: bank 1 intake"
Expand Down
36 changes: 35 additions & 1 deletion firmware/tunerstudio/rusefi.input
Original file line number Diff line number Diff line change
Expand Up @@ -1208,7 +1208,41 @@ curve = 32Curve, "3-2 Shift Solenoid Percent by Speed"


[GaugeConfigurations]
@@LIVE_DATA_GAUGES_FROM_FILE@@
gaugeCategory = "Fuel: math"
totalFuelCorrectionGauge = totalFuelCorrection,"Fuel: Total correction", "mult", 0.0,3.0, 0.0,3.0, 0.0,3.0, 2,2
running_timeSinceCrankingInSecsGauge = running_timeSinceCrankingInSecs,"running_ timeSinceCrankingInSecs", "secs", 0.0,600000.0, 0.0,600000.0, 0.0,600000.0, 0,0
targetLambdaGauge = targetLambda,"Fuel: target lambda", "", 0.5,1.5, 0.5,1.5, 0.5,1.5, 2,2
targetAFRGauge = targetAFR,"Fuel: target AFR", "ratio", 10.0,20.0, 10.0,20.0, 10.0,20.0, 2,2
gaugeCategory = "Timing"
baseDwellGauge = baseDwell,"baseDwell", "ms", 0.0,30.0, 0.0,30.0, 0.0,30.0, 1,1
sparkDwellGauge = sparkDwell,"Ign: Dwell", "ms", 0.0,30.0, 0.0,30.0, 0.0,30.0, 1,1
dwellAngleGauge = dwellAngle,"ignition dwell duration", "deg", 0.0,120.0, 0.0,120.0, 0.0,120.0, 1,1
cltTimingCorrectionGauge = cltTimingCorrection,"Ign: CLT correction", "deg", -20.0,20.0, -20.0,20.0, -20.0,20.0, 2,2
timingIatCorrectionGauge = timingIatCorrection,"Ign: IAT correction", "deg", -20.0,20.0, -20.0,20.0, -20.0,20.0, 2,2
timingPidCorrectionGauge = timingPidCorrection,"Idle: Timing adjustment", "deg", -20.0,20.0, -20.0,20.0, -20.0,20.0, 2,2
luaTimingAddGauge = luaTimingAdd,"Ign: Lua timing add", "deg", -20.0,20.0, -20.0,20.0, -20.0,20.0, 2,2
luaTimingMultGauge = luaTimingMult,"Ign: Lua timing mult", "deg", -20.0,20.0, -20.0,20.0, -20.0,20.0, 2,2
gaugeCategory = "Boost Control"
luaTargetAddGauge = luaTargetAdd,"Boost: Lua target add", "v", -100.0,100.0, -100.0,100.0, -100.0,100.0, 1,1
boostOutputGauge = boostOutput,"Boost: Output", "percent", -100.0,100.0, -100.0,100.0, -100.0,100.0, 2,2
luaTargetMultGauge = luaTargetMult,"Boost: Lua target mult", "v", -100.0,100.0, -100.0,100.0, -100.0,100.0, 1,1
openLoopPartGauge = openLoopPart,"Boost: Open loop", "v", -100.0,100.0, -100.0,100.0, -100.0,100.0, 1,1
luaOpenLoopAddGauge = luaOpenLoopAdd,"Boost: Lua open loop add", "v", -100.0,100.0, -100.0,100.0, -100.0,100.0, 1,1
boostControllerClosedLoopPartGauge = boostControllerClosedLoopPart,"Boost: Closed loop", "%", -50.0,50.0, -50.0,50.0, -50.0,50.0, 1,1
boostControlTargetGauge = boostControlTarget,"Boost: Target", "kPa", 0.0,300.0, 0.0,300.0, 0.0,300.0, 1,1
gaugeCategory = "ETB more"
idlePositionGauge = idlePosition,"ETB: idlePosition", "per", 0.0,10.0, 0.0,10.0, 0.0,10.0, 2,2
luaAdjustmentGauge = luaAdjustment,"ETB: luaAdjustment", "per", 0.0,3.0, 0.0,3.0, 0.0,3.0, 2,2
m_wastegatePositionGauge = m_wastegatePosition,"DC: wastegatePosition", "per", 0.0,3.0, 0.0,3.0, 0.0,3.0, 2,2
etbDutyRateOfChangeGauge = etbDutyRateOfChange,"ETB duty rate of change", "per", -0.0,20.0, -0.0,20.0, -0.0,20.0, 2,2
etbDutyAverageGauge = etbDutyAverage,"ETB average duty", "per", -20.0,50.0, -20.0,50.0, -20.0,50.0, 2,2
etbTpsErrorCounterGauge = etbTpsErrorCounter,"ETB TPS error counter", "count", 0.0,3.0, 0.0,3.0, 0.0,3.0, 0,0
etbPpsErrorCounterGauge = etbPpsErrorCounter,"ETB pedal error counter", "count", 0.0,3.0, 0.0,3.0, 0.0,3.0, 0,0
dcOutput0Gauge = dcOutput0,"DC: output0", "per", 0.0,10.0, 0.0,10.0, 0.0,10.0, 2,2
isEnabled0_intGauge = isEnabled0_int,"DC: en0", "per", 0.0,10.0, 0.0,10.0, 0.0,10.0, 2,2
value0Gauge = value0,"ETB: SENT value0", "value", 0.0,3.0, 0.0,3.0, 0.0,3.0, 0,0
value1Gauge = value1,"ETB: SENT value1", "value", 0.0,3.0, 0.0,3.0, 0.0,3.0, 0,0
errorRateGauge = errorRate,"ETB: SENT error rate", "ratio", 0.0,3.0, 0.0,3.0, 0.0,3.0, 2,2

gaugeCategory = Trigger
triggerErrorsCounterGauge = totalTriggerErrorCounter, "Trigger error count", "count", 0, 15000, 0, 0, 6000, 6000, 0, 0
Expand Down
Binary file modified java_tools/ConfigDefinition.jar
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@ public class LiveDataProcessor {

private final static String tsOutputsDestination = "console/binary/";

private final GaugeConsumer gaugeConsumer = new GaugeConsumer(tsOutputsDestination + File.separator + "generated/gauges.ini");

private final StringBuilder enumContent = new StringBuilder(header +
"#pragma once\n" +
"\n" +
Expand Down Expand Up @@ -75,11 +73,6 @@ public static void main(String[] args) throws IOException {
try (FileWriter fw = new FileWriter("console/binary/generated/fancy_menu.ini")) {
fw.write(liveDataProcessor.fancyNewMenu.toString());
}
liveDataProcessor.end();
}

private void end() throws IOException {
gaugeConsumer.endFile();
}

interface EntryHandler {
Expand Down Expand Up @@ -135,12 +128,6 @@ public void onEntry(String name, String javaName, String folder, String prepend,
state.addDestination((state1, structure) -> outputValueConsumer.handleEndStruct(state1, structure));

}
state.addDestination(new ConfigurationConsumer() {
@Override
public void handleEndStruct(ReaderState readerState, ConfigStructure structure) throws IOException {
gaugeConsumer.handleEndStruct(readerState, structure);
}
});

{
ParseState parseState = new ParseState(state.getEnumsReader());
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import com.rusefi.ReaderStateImpl;
import com.rusefi.newparse.outputs.OutputChannelWriter;
import com.rusefi.output.DataLogConsumer;
import com.rusefi.output.GaugeConsumer;
import com.rusefi.output.GetOutputValueConsumer;
import com.rusefi.output.OutputsSectionConsumer;
import org.jetbrains.annotations.NotNull;
Expand Down Expand Up @@ -183,22 +182,13 @@ public void sensorStruct() {
ReaderStateImpl state = new ReaderStateImpl();
state.getVariableRegistry().register("GAUGE_CATEGORY", "Alternator");
DataLogConsumer dataLogConsumer = new DataLogConsumer(null);
GaugeConsumer gaugeConsumer = new GaugeConsumer(null);
state.readBufferedReader(test, dataLogConsumer, gaugeConsumer);
state.readBufferedReader(test, dataLogConsumer);
assertEquals(
"entry = alternatorStatus_iTerm, \"alternatorStatus_iTerm\", float, \"%.3f\"\n" +
"entry = alternatorStatus_dTerm, \"alternatorStatus_dTerm\", float, \"%.3f\"\n" +
"entry = idleStatus_iTerm, \"idleStatus_iTerm\", float, \"%.3f\"\n" +
"entry = idleStatus_dTerm, \"idleStatus_dTerm\", float, \"%.3f\"\n",
dataLogConsumer.getContent());

assertEquals("\tgaugeCategory = Alternator\n" +
"alternatorStatus_iTermGauge = alternatorStatus_iTerm,\"alternatorStatus_ iTerm\", \"v\", -10000.0,10000.0, -10000.0,10000.0, -10000.0,10000.0, 4,4\n" +
"alternatorStatus_dTermGauge = alternatorStatus_dTerm,\"alternatorStatus_ dTerm\", \"v\", -10000.0,10000.0, -10000.0,10000.0, -10000.0,10000.0, 4,4\n" +
"idleStatus_iTermGauge = idleStatus_iTerm,\"idleStatus_ iTerm\", \"v\", -10000.0,10000.0, -10000.0,10000.0, -10000.0,10000.0, 4,4\n" +
"idleStatus_dTermGauge = idleStatus_dTerm,\"idleStatus_ dTerm\", \"v\", -10000.0,10000.0, -10000.0,10000.0, -10000.0,10000.0, 4,4\n",
gaugeConsumer.getContent());

}

@Test
Expand Down
Binary file modified java_tools/enum2string.jar
Binary file not shown.

0 comments on commit e793519

Please sign in to comment.