logging of live data structs was: data points #3614
progress & more consistent convention
This commit is contained in:
parent
cd080b159f
commit
57be5a2147
|
@ -170,7 +170,7 @@ static void handlePageSelectCommand(TsChannelBase *tsChannel, ts_response_format
|
||||||
|
|
||||||
#if EFI_TUNER_STUDIO
|
#if EFI_TUNER_STUDIO
|
||||||
|
|
||||||
static const void * getStructAddr(live_data_e structId) {
|
const void * getStructAddr(live_data_e structId) {
|
||||||
switch (structId) {
|
switch (structId) {
|
||||||
#if EFI_HPFP
|
#if EFI_HPFP
|
||||||
case LDS_high_pressure_fuel_pump:
|
case LDS_high_pressure_fuel_pump:
|
||||||
|
@ -188,12 +188,12 @@ static const void * getStructAddr(live_data_e structId) {
|
||||||
return static_cast<ac_control_s*>(&engine->module<AcController>().unmock());
|
return static_cast<ac_control_s*>(&engine->module<AcController>().unmock());
|
||||||
case LDS_fan_control:
|
case LDS_fan_control:
|
||||||
return static_cast<fan_control_s*>(&engine->fan1);
|
return static_cast<fan_control_s*>(&engine->fan1);
|
||||||
case LDS_fuel_pump:
|
case LDS_fuel_pump_control:
|
||||||
return static_cast<fuel_pump_control_s*>(&engine->module<FuelPumpController>().unmock());
|
return static_cast<fuel_pump_control_s*>(&engine->module<FuelPumpController>().unmock());
|
||||||
case LDS_main_relay:
|
case LDS_main_relay:
|
||||||
return static_cast<main_relay_s*>(&engine->module<MainRelayController>().unmock());
|
return static_cast<main_relay_s*>(&engine->module<MainRelayController>().unmock());
|
||||||
case LDS_engine_state:
|
case LDS_engine_state:
|
||||||
return static_cast<engine_state2_s*>(&engine->engineState);
|
return static_cast<engine_state_s*>(&engine->engineState);
|
||||||
case LDS_tps_accel_state:
|
case LDS_tps_accel_state:
|
||||||
return static_cast<tps_accel_state_s*>(&engine->tpsAccelEnrichment);
|
return static_cast<tps_accel_state_s*>(&engine->tpsAccelEnrichment);
|
||||||
case LDS_trigger_central:
|
case LDS_trigger_central:
|
||||||
|
@ -201,7 +201,7 @@ static const void * getStructAddr(live_data_e structId) {
|
||||||
case LDS_trigger_state:
|
case LDS_trigger_state:
|
||||||
return static_cast<trigger_state_s*>(&engine->triggerCentral.triggerState);
|
return static_cast<trigger_state_s*>(&engine->triggerCentral.triggerState);
|
||||||
case LDS_wall_fuel_state:
|
case LDS_wall_fuel_state:
|
||||||
return static_cast<wall_fuel_state*>(&engine->injectionEvents.elements[0].wallFuel);
|
return static_cast<wall_fuel_state_s*>(&engine->injectionEvents.elements[0].wallFuel);
|
||||||
case LDS_idle_state:
|
case LDS_idle_state:
|
||||||
return static_cast<idle_state_s*>(&engine->module<IdleController>().unmock());
|
return static_cast<idle_state_s*>(&engine->module<IdleController>().unmock());
|
||||||
case LDS_ignition_state:
|
case LDS_ignition_state:
|
||||||
|
|
|
@ -30,6 +30,7 @@ void tunerStudioDebug(TsChannelBase* tsChannel, const char *msg);
|
||||||
void tunerStudioError(TsChannelBase* tsChannel, const char *msg);
|
void tunerStudioError(TsChannelBase* tsChannel, const char *msg);
|
||||||
|
|
||||||
uint8_t* getWorkingPageAddr();
|
uint8_t* getWorkingPageAddr();
|
||||||
|
const void * getStructAddr(live_data_e structId);
|
||||||
|
|
||||||
#if EFI_TUNER_STUDIO
|
#if EFI_TUNER_STUDIO
|
||||||
#include "thread_controller.h"
|
#include "thread_controller.h"
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
TUNERSTUDIO_SRC_CPP = $(PROJECT_DIR)/console/binary/tunerstudio_io.cpp \
|
TUNERSTUDIO_SRC_CPP = $(PROJECT_DIR)/console/binary/tunerstudio_io.cpp \
|
||||||
$(PROJECT_DIR)/console/binary/tunerstudio_io_serial.cpp \
|
$(PROJECT_DIR)/console/binary/tunerstudio_io_serial.cpp \
|
||||||
$(PROJECT_DIR)/console/binary/tunerstudio_io_serial_ports.cpp \
|
$(PROJECT_DIR)/console/binary/tunerstudio_io_serial_ports.cpp \
|
||||||
|
$(PROJECT_DIR)/console/binary/generated/live_data_fragments.cpp \
|
||||||
$(PROJECT_DIR)/console/binary/ts_can_channel.cpp \
|
$(PROJECT_DIR)/console/binary/ts_can_channel.cpp \
|
||||||
$(PROJECT_DIR)/console/binary/serial_can.cpp \
|
$(PROJECT_DIR)/console/binary/serial_can.cpp \
|
||||||
$(PROJECT_DIR)/console/binary/tunerstudio.cpp \
|
$(PROJECT_DIR)/console/binary/tunerstudio.cpp \
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "engine_module.h"
|
#include "engine_module.h"
|
||||||
#include "fuel_pump_generated.h"
|
#include "fuel_pump_control_generated.h"
|
||||||
|
|
||||||
class FuelPumpController : public EngineModule, public fuel_pump_control_s {
|
class FuelPumpController : public EngineModule, public fuel_pump_control_s {
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// this section was generated automatically by rusEFI tool ConfigDefinition.jar based on (unknown script) controllers/actuators/fuel_pump.txt Wed Jan 05 06:47:26 UTC 2022
|
// this section was generated automatically by rusEFI tool ConfigDefinition.jar based on (unknown script) controllers/actuators\fuel_pump_control.txt Wed Apr 13 20:37:15 EDT 2022
|
||||||
// by class com.rusefi.output.CHeaderConsumer
|
// by class com.rusefi.output.CHeaderConsumer
|
||||||
// begin
|
// begin
|
||||||
#pragma once
|
#pragma once
|
||||||
|
@ -105,4 +105,4 @@ struct fuel_pump_control_s {
|
||||||
};
|
};
|
||||||
|
|
||||||
// end
|
// end
|
||||||
// this section was generated automatically by rusEFI tool ConfigDefinition.jar based on (unknown script) controllers/actuators/fuel_pump.txt Wed Jan 05 06:47:26 UTC 2022
|
// this section was generated automatically by rusEFI tool ConfigDefinition.jar based on (unknown script) controllers/actuators\fuel_pump_control.txt Wed Apr 13 20:37:15 EDT 2022
|
|
@ -23,7 +23,7 @@ struct LuaAdjustments {
|
||||||
bool brakePedalState = false;
|
bool brakePedalState = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
class EngineState : public engine_state2_s {
|
class EngineState : public engine_state_s {
|
||||||
public:
|
public:
|
||||||
EngineState();
|
EngineState();
|
||||||
void periodicFastCallback();
|
void periodicFastCallback();
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
|
|
||||||
|
|
||||||
struct_no_prefix engine_state2_s
|
struct_no_prefix engine_state_s
|
||||||
|
|
||||||
struct_no_prefix speed_density_s
|
struct_no_prefix speed_density_s
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// this section was generated automatically by rusEFI tool ConfigDefinition.jar based on (unknown script) controllers/algo/engine_state.txt Wed Jan 05 06:47:26 UTC 2022
|
// this section was generated automatically by rusEFI tool ConfigDefinition.jar based on (unknown script) controllers/algo\engine_state.txt Wed Apr 13 20:37:15 EDT 2022
|
||||||
// by class com.rusefi.output.CHeaderConsumer
|
// by class com.rusefi.output.CHeaderConsumer
|
||||||
// begin
|
// begin
|
||||||
#pragma once
|
#pragma once
|
||||||
|
@ -196,8 +196,8 @@ struct running_fuel_s {
|
||||||
/** total size 28*/
|
/** total size 28*/
|
||||||
};
|
};
|
||||||
|
|
||||||
// start of engine_state2_s
|
// start of engine_state_s
|
||||||
struct engine_state2_s {
|
struct engine_state_s {
|
||||||
/**
|
/**
|
||||||
* offset 0
|
* offset 0
|
||||||
*/
|
*/
|
||||||
|
@ -275,4 +275,4 @@ struct engine_state2_s {
|
||||||
};
|
};
|
||||||
|
|
||||||
// end
|
// end
|
||||||
// this section was generated automatically by rusEFI tool ConfigDefinition.jar based on (unknown script) controllers/algo/engine_state.txt Wed Jan 05 06:47:26 UTC 2022
|
// this section was generated automatically by rusEFI tool ConfigDefinition.jar based on (unknown script) controllers/algo\engine_state.txt Wed Apr 13 20:37:15 EDT 2022
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
* Wall wetting, also known as fuel film
|
* Wall wetting, also known as fuel film
|
||||||
* See https://github.com/rusefi/rusefi/issues/151 for the theory
|
* See https://github.com/rusefi/rusefi/issues/151 for the theory
|
||||||
*/
|
*/
|
||||||
class WallFuel : public wall_fuel_state {
|
class WallFuel : public wall_fuel_state_s {
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
* @param desiredMassGrams desired fuel quantity, in grams
|
* @param desiredMassGrams desired fuel quantity, in grams
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
struct_no_prefix wall_fuel_state
|
struct_no_prefix wall_fuel_state_s
|
||||||
float wallFuelCorrection;* fuel injection time correction to account for wall wetting effect, for current cycle
|
float wallFuelCorrection;* fuel injection time correction to account for wall wetting effect, for current cycle
|
||||||
floatms_t wallFuel;Amount of fuel on the wall, in ms of injector open time, for each injector.
|
floatms_t wallFuel;Amount of fuel on the wall, in ms of injector open time, for each injector.
|
||||||
! wall_fuel_state
|
! wall_fuel_state
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
// this section was generated automatically by rusEFI tool ConfigDefinition.jar based on (unknown script) controllers/algo/wall_fuel_state.txt Wed Jan 05 06:47:26 UTC 2022
|
// this section was generated automatically by rusEFI tool ConfigDefinition.jar based on (unknown script) controllers/algo\wall_fuel_state.txt Wed Apr 13 20:40:04 EDT 2022
|
||||||
// by class com.rusefi.output.CHeaderConsumer
|
// by class com.rusefi.output.CHeaderConsumer
|
||||||
// begin
|
// begin
|
||||||
#pragma once
|
#pragma once
|
||||||
#include "rusefi_types.h"
|
#include "rusefi_types.h"
|
||||||
// start of wall_fuel_state
|
// start of wall_fuel_state_s
|
||||||
struct wall_fuel_state {
|
struct wall_fuel_state_s {
|
||||||
/**
|
/**
|
||||||
* * fuel injection time correction to account for wall wetting effect, for current cycle
|
* * fuel injection time correction to account for wall wetting effect, for current cycle
|
||||||
* offset 0
|
* offset 0
|
||||||
|
@ -19,4 +19,4 @@ struct wall_fuel_state {
|
||||||
};
|
};
|
||||||
|
|
||||||
// end
|
// end
|
||||||
// this section was generated automatically by rusEFI tool ConfigDefinition.jar based on (unknown script) controllers/algo/wall_fuel_state.txt Wed Jan 05 06:47:26 UTC 2022
|
// this section was generated automatically by rusEFI tool ConfigDefinition.jar based on (unknown script) controllers/algo\wall_fuel_state.txt Wed Apr 13 20:40:04 EDT 2022
|
||||||
|
|
|
@ -9,7 +9,7 @@ Usages:
|
||||||
boost_control: [ "BoostControl.java", "controllers/actuators" ]
|
boost_control: [ "BoostControl.java", "controllers/actuators" ]
|
||||||
ac_control: [ "AcControl.java", "controllers/actuators" ]
|
ac_control: [ "AcControl.java", "controllers/actuators" ]
|
||||||
fan_control: [ "FanControl.java", "controllers/actuators" ]
|
fan_control: [ "FanControl.java", "controllers/actuators" ]
|
||||||
fuel_pump: [ "FuelPump.java", "controllers/actuators" ]
|
fuel_pump_control: [ "FuelPump.java", "controllers/actuators" ]
|
||||||
main_relay: [ "MainRelay.java", "controllers/actuators" ]
|
main_relay: [ "MainRelay.java", "controllers/actuators" ]
|
||||||
#todo: handle ETB pid and Idle pid which point at same pid_state.txt
|
#todo: handle ETB pid and Idle pid which point at same pid_state.txt
|
||||||
#pid_state: [ "PidState.java", "util/math" ]
|
#pid_state: [ "PidState.java", "util/math" ]
|
||||||
|
|
Binary file not shown.
|
@ -1,15 +1,16 @@
|
||||||
package com.rusefi.ldmp;
|
package com.rusefi.ldmp;
|
||||||
|
|
||||||
import com.rusefi.ConfigDefinition;
|
import com.rusefi.ConfigDefinition;
|
||||||
import com.rusefi.util.SystemOut;
|
|
||||||
import org.yaml.snakeyaml.Yaml;
|
import org.yaml.snakeyaml.Yaml;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileReader;
|
import java.io.FileReader;
|
||||||
import java.io.FileWriter;
|
import java.io.FileWriter;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.util.LinkedHashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.TreeMap;
|
||||||
|
|
||||||
public class UsagesReader {
|
public class UsagesReader {
|
||||||
public static void main(String[] args) throws IOException {
|
public static void main(String[] args) throws IOException {
|
||||||
|
@ -21,12 +22,21 @@ public class UsagesReader {
|
||||||
Yaml yaml = new Yaml();
|
Yaml yaml = new Yaml();
|
||||||
Map<String, Object> data = yaml.load(new FileReader(yamlFileName));
|
Map<String, Object> data = yaml.load(new FileReader(yamlFileName));
|
||||||
|
|
||||||
StringBuilder enumContent = new StringBuilder("// generated by gen_live_documentation.sh / UsagesReader.java\n" +
|
String header = "// generated by gen_live_documentation.sh / UsagesReader.java\n";
|
||||||
|
StringBuilder enumContent = new StringBuilder(header +
|
||||||
"#pragma once\n" +
|
"#pragma once\n" +
|
||||||
"\n" +
|
"\n" +
|
||||||
"typedef enum {\n");
|
"typedef enum {\n");
|
||||||
|
|
||||||
Map<?, ?> liveDocs = (Map) data.get("Usages");
|
StringBuilder fragmentsContent = new StringBuilder(
|
||||||
|
header +
|
||||||
|
"#include \"pch.h\"\n" +
|
||||||
|
"#include \"FragmentEntry.h\"\n\n" +
|
||||||
|
"#include \"tunerstudio.h\"\n" +
|
||||||
|
"static FragmentEntry fragments[] = {\n");
|
||||||
|
|
||||||
|
|
||||||
|
LinkedHashMap<?, ?> liveDocs = (LinkedHashMap) data.get("Usages");
|
||||||
for (Map.Entry entry : liveDocs.entrySet()) {
|
for (Map.Entry entry : liveDocs.entrySet()) {
|
||||||
String name = (String) entry.getKey();
|
String name = (String) entry.getKey();
|
||||||
System.out.println(" " + name);
|
System.out.println(" " + name);
|
||||||
|
@ -35,6 +45,7 @@ public class UsagesReader {
|
||||||
|
|
||||||
String javaName = (String) elements.get(0);
|
String javaName = (String) elements.get(0);
|
||||||
String folder = (String) elements.get(1);
|
String folder = (String) elements.get(1);
|
||||||
|
// String macroName = elements.size() > 2 ? ((String)elements.get(2)).trim() : "";
|
||||||
|
|
||||||
|
|
||||||
ConfigDefinition.main(new String[]{
|
ConfigDefinition.main(new String[]{
|
||||||
|
@ -48,12 +59,27 @@ public class UsagesReader {
|
||||||
folder + File.separator + name + "_generated.h"
|
folder + File.separator + name + "_generated.h"
|
||||||
});
|
});
|
||||||
|
|
||||||
enumContent.append("LDS_" + name + ",\n");
|
String enumName = "LDS_" + name;
|
||||||
|
String type = name + "_s"; // convention
|
||||||
|
enumContent.append(enumName + ",\n");
|
||||||
|
|
||||||
|
fragmentsContent
|
||||||
|
.append("\tFragmentEntry((const uint8_t *)getStructAddr(")
|
||||||
|
.append(enumName)
|
||||||
|
.append("), sizeof(")
|
||||||
|
.append(type)
|
||||||
|
.append(")),\n");
|
||||||
}
|
}
|
||||||
enumContent.append("} live_data_e;\n");
|
enumContent.append("} live_data_e;\n");
|
||||||
|
|
||||||
try (FileWriter fw = new FileWriter("console/binary/generated/live_data_ids.h")) {
|
try (FileWriter fw = new FileWriter("console/binary/generated/live_data_ids.h")) {
|
||||||
fw.write(enumContent.toString());
|
fw.write(enumContent.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fragmentsContent.append("};\n");
|
||||||
|
|
||||||
|
try (FileWriter fw = new FileWriter("console/binary/generated/live_data_fragments.cpp")) {
|
||||||
|
fw.write(fragmentsContent.toString());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue