logging of live data structs was: data points #3614
progress & more consistent convention
This commit is contained in:
parent
53d31ee0ea
commit
4834683dc6
|
@ -0,0 +1,22 @@
|
|||
// generated by gen_live_documentation.sh / UsagesReader.java
|
||||
#include "pch.h"
|
||||
#include "FragmentEntry.h"
|
||||
|
||||
#include "tunerstudio.h"
|
||||
static FragmentEntry fragments[] = {
|
||||
FragmentEntry((const uint8_t *)getStructAddr(LDS_high_pressure_fuel_pump), sizeof(high_pressure_fuel_pump_s)),
|
||||
FragmentEntry((const uint8_t *)getStructAddr(LDS_injector_model), sizeof(injector_model_s)),
|
||||
FragmentEntry((const uint8_t *)getStructAddr(LDS_launch_control_state), sizeof(launch_control_state_s)),
|
||||
FragmentEntry((const uint8_t *)getStructAddr(LDS_boost_control), sizeof(boost_control_s)),
|
||||
FragmentEntry((const uint8_t *)getStructAddr(LDS_ac_control), sizeof(ac_control_s)),
|
||||
FragmentEntry((const uint8_t *)getStructAddr(LDS_fan_control), sizeof(fan_control_s)),
|
||||
FragmentEntry((const uint8_t *)getStructAddr(LDS_fuel_pump_control), sizeof(fuel_pump_control_s)),
|
||||
FragmentEntry((const uint8_t *)getStructAddr(LDS_main_relay), sizeof(main_relay_s)),
|
||||
FragmentEntry((const uint8_t *)getStructAddr(LDS_engine_state), sizeof(engine_state_s)),
|
||||
FragmentEntry((const uint8_t *)getStructAddr(LDS_tps_accel_state), sizeof(tps_accel_state_s)),
|
||||
FragmentEntry((const uint8_t *)getStructAddr(LDS_trigger_central), sizeof(trigger_central_s)),
|
||||
FragmentEntry((const uint8_t *)getStructAddr(LDS_trigger_state), sizeof(trigger_state_s)),
|
||||
FragmentEntry((const uint8_t *)getStructAddr(LDS_wall_fuel_state), sizeof(wall_fuel_state_s)),
|
||||
FragmentEntry((const uint8_t *)getStructAddr(LDS_idle_state), sizeof(idle_state_s)),
|
||||
FragmentEntry((const uint8_t *)getStructAddr(LDS_ignition_state), sizeof(ignition_state_s)),
|
||||
}
|
|
@ -8,7 +8,7 @@ LDS_launch_control_state,
|
|||
LDS_boost_control,
|
||||
LDS_ac_control,
|
||||
LDS_fan_control,
|
||||
LDS_fuel_pump,
|
||||
LDS_fuel_pump_control,
|
||||
LDS_main_relay,
|
||||
LDS_engine_state,
|
||||
LDS_tps_accel_state,
|
||||
|
|
|
@ -170,7 +170,7 @@ static void handlePageSelectCommand(TsChannelBase *tsChannel, ts_response_format
|
|||
|
||||
#if EFI_TUNER_STUDIO
|
||||
|
||||
static const void * getStructAddr(live_data_e structId) {
|
||||
const void * getStructAddr(live_data_e structId) {
|
||||
switch (structId) {
|
||||
#if EFI_HPFP
|
||||
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());
|
||||
case LDS_fan_control:
|
||||
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());
|
||||
case LDS_main_relay:
|
||||
return static_cast<main_relay_s*>(&engine->module<MainRelayController>().unmock());
|
||||
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:
|
||||
return static_cast<tps_accel_state_s*>(&engine->tpsAccelEnrichment);
|
||||
case LDS_trigger_central:
|
||||
|
@ -201,7 +201,7 @@ static const void * getStructAddr(live_data_e structId) {
|
|||
case LDS_trigger_state:
|
||||
return static_cast<trigger_state_s*>(&engine->triggerCentral.triggerState);
|
||||
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:
|
||||
return static_cast<idle_state_s*>(&engine->module<IdleController>().unmock());
|
||||
case LDS_ignition_state:
|
||||
|
|
|
@ -30,6 +30,7 @@ void tunerStudioDebug(TsChannelBase* tsChannel, const char *msg);
|
|||
void tunerStudioError(TsChannelBase* tsChannel, const char *msg);
|
||||
|
||||
uint8_t* getWorkingPageAddr();
|
||||
const void * getStructAddr(live_data_e structId);
|
||||
|
||||
#if EFI_TUNER_STUDIO
|
||||
#include "thread_controller.h"
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
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_ports.cpp \
|
||||
$(PROJECT_DIR)/console/binary/generated/live_data_fragments.cpp \
|
||||
$(PROJECT_DIR)/console/binary/ts_can_channel.cpp \
|
||||
$(PROJECT_DIR)/console/binary/serial_can.cpp \
|
||||
$(PROJECT_DIR)/console/binary/tunerstudio.cpp \
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#pragma once
|
||||
|
||||
#include "engine_module.h"
|
||||
#include "fuel_pump_generated.h"
|
||||
#include "fuel_pump_control_generated.h"
|
||||
|
||||
class FuelPumpController : public EngineModule, public fuel_pump_control_s {
|
||||
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
|
||||
// begin
|
||||
#pragma once
|
||||
|
@ -105,4 +105,4 @@ struct fuel_pump_control_s {
|
|||
};
|
||||
|
||||
// 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;
|
||||
};
|
||||
|
||||
class EngineState : public engine_state2_s {
|
||||
class EngineState : public engine_state_s {
|
||||
public:
|
||||
EngineState();
|
||||
void periodicFastCallback();
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
|
||||
|
||||
struct_no_prefix engine_state2_s
|
||||
struct_no_prefix engine_state_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
|
||||
// begin
|
||||
#pragma once
|
||||
|
@ -196,8 +196,8 @@ struct running_fuel_s {
|
|||
/** total size 28*/
|
||||
};
|
||||
|
||||
// start of engine_state2_s
|
||||
struct engine_state2_s {
|
||||
// start of engine_state_s
|
||||
struct engine_state_s {
|
||||
/**
|
||||
* offset 0
|
||||
*/
|
||||
|
@ -275,4 +275,4 @@ struct engine_state2_s {
|
|||
};
|
||||
|
||||
// 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
|
||||
* 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:
|
||||
/**
|
||||
* @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
|
||||
floatms_t wallFuel;Amount of fuel on the wall, in ms of injector open time, for each injector.
|
||||
! 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
|
||||
// begin
|
||||
#pragma once
|
||||
#include "rusefi_types.h"
|
||||
// start of wall_fuel_state
|
||||
struct wall_fuel_state {
|
||||
// start of wall_fuel_state_s
|
||||
struct wall_fuel_state_s {
|
||||
/**
|
||||
* * fuel injection time correction to account for wall wetting effect, for current cycle
|
||||
* offset 0
|
||||
|
@ -19,4 +19,4 @@ struct wall_fuel_state {
|
|||
};
|
||||
|
||||
// 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" ]
|
||||
ac_control: [ "AcControl.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" ]
|
||||
#todo: handle ETB pid and Idle pid which point at same pid_state.txt
|
||||
#pid_state: [ "PidState.java", "util/math" ]
|
||||
|
|
Binary file not shown.
|
@ -1,15 +1,16 @@
|
|||
package com.rusefi.ldmp;
|
||||
|
||||
import com.rusefi.ConfigDefinition;
|
||||
import com.rusefi.util.SystemOut;
|
||||
import org.yaml.snakeyaml.Yaml;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileReader;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.TreeMap;
|
||||
|
||||
public class UsagesReader {
|
||||
public static void main(String[] args) throws IOException {
|
||||
|
@ -21,12 +22,21 @@ public class UsagesReader {
|
|||
Yaml yaml = new Yaml();
|
||||
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" +
|
||||
"\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()) {
|
||||
String name = (String) entry.getKey();
|
||||
System.out.println(" " + name);
|
||||
|
@ -35,6 +45,7 @@ public class UsagesReader {
|
|||
|
||||
String javaName = (String) elements.get(0);
|
||||
String folder = (String) elements.get(1);
|
||||
// String macroName = elements.size() > 2 ? ((String)elements.get(2)).trim() : "";
|
||||
|
||||
|
||||
ConfigDefinition.main(new String[]{
|
||||
|
@ -48,12 +59,27 @@ public class UsagesReader {
|
|||
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");
|
||||
|
||||
try (FileWriter fw = new FileWriter("console/binary/generated/live_data_ids.h")) {
|
||||
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