logging of live data structs was: data points #3614
This commit is contained in:
parent
7cbe075bab
commit
725e5467bd
|
@ -9,12 +9,19 @@
|
||||||
|
|
||||||
struct FragmentEntry {
|
struct FragmentEntry {
|
||||||
FragmentEntry(const uint8_t *data, size_t size) {
|
FragmentEntry(const uint8_t *data, size_t size) {
|
||||||
|
init(data, size);
|
||||||
|
}
|
||||||
|
|
||||||
|
FragmentEntry() {
|
||||||
|
}
|
||||||
|
|
||||||
|
const uint8_t *data = nullptr;
|
||||||
|
size_t size = 0;
|
||||||
|
|
||||||
|
void init(const uint8_t *data, size_t size) {
|
||||||
this->data = data;
|
this->data = data;
|
||||||
this->size = size;
|
this->size = size;
|
||||||
}
|
}
|
||||||
|
|
||||||
const uint8_t *data;
|
|
||||||
size_t size;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
void copyRange(uint8_t *destination, FragmentEntry *fragments, size_t dataOffset, size_t dataLength);
|
void copyRange(uint8_t *destination, FragmentEntry *fragments, size_t dataOffset, size_t dataLength);
|
||||||
|
|
|
@ -171,29 +171,37 @@ static void handlePageSelectCommand(TsChannelBase *tsChannel, ts_response_format
|
||||||
#if EFI_TUNER_STUDIO
|
#if EFI_TUNER_STUDIO
|
||||||
|
|
||||||
const void * getStructAddr(live_data_e structId) {
|
const void * getStructAddr(live_data_e structId) {
|
||||||
|
#if EFI_UNIT_TEST
|
||||||
if (engine == nullptr) {
|
if (engine == nullptr) {
|
||||||
#if ! EFI_UNIT_TEST
|
|
||||||
firmwareError(OBD_PCM_Processor_Fault, "getStructAddr: No engine reference");
|
|
||||||
#endif
|
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
switch (structId) {
|
switch (structId) {
|
||||||
|
|
||||||
case LDS_high_pressure_fuel_pump:
|
case LDS_high_pressure_fuel_pump:
|
||||||
#if EFI_HPFP
|
#if EFI_HPFP
|
||||||
return static_cast<high_pressure_fuel_pump_s*>(&engine->module<HpfpController>().unmock());
|
return static_cast<high_pressure_fuel_pump_s*>(&engine->module<HpfpController>().unmock());
|
||||||
#else
|
#else
|
||||||
return nullptr; // explicit null to confirm that this struct is handled
|
return nullptr; // explicit null to confirm that this struct is handled
|
||||||
#endif // EFI_HPFP
|
#endif // EFI_HPFP
|
||||||
|
|
||||||
case LDS_launch_control_state:
|
case LDS_launch_control_state:
|
||||||
|
#if EFI_LAUNCH_CONTROL
|
||||||
return static_cast<launch_control_state_s*>(&engine->launchController);
|
return static_cast<launch_control_state_s*>(&engine->launchController);
|
||||||
|
#else
|
||||||
|
return nullptr; // explicit null to confirm that this struct is handled
|
||||||
|
#endif // EFI_LAUNCH_CONTROL
|
||||||
|
|
||||||
case LDS_injector_model:
|
case LDS_injector_model:
|
||||||
return static_cast<injector_model_s*>(&engine->module<InjectorModel>().unmock());
|
return static_cast<injector_model_s*>(&engine->module<InjectorModel>().unmock());
|
||||||
|
|
||||||
case LDS_boost_control:
|
case LDS_boost_control:
|
||||||
#if EFI_BOOST_CONTROL
|
#if EFI_BOOST_CONTROL
|
||||||
return static_cast<boost_control_s*>(&engine->boostController);
|
return static_cast<boost_control_s*>(&engine->boostController);
|
||||||
#else
|
#else
|
||||||
return nullptr; // explicit null to confirm that this struct is handled
|
return nullptr; // explicit null to confirm that this struct is handled
|
||||||
#endif // EFI_BOOST_CONTROL
|
#endif // EFI_BOOST_CONTROL
|
||||||
|
|
||||||
case LDS_ac_control:
|
case LDS_ac_control:
|
||||||
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:
|
||||||
|
|
Binary file not shown.
|
@ -28,16 +28,18 @@ public class UsagesReader {
|
||||||
"\n" +
|
"\n" +
|
||||||
"typedef enum {\n");
|
"typedef enum {\n");
|
||||||
|
|
||||||
|
LinkedHashMap<?, ?> liveDocs = (LinkedHashMap) data.get("Usages");
|
||||||
|
|
||||||
StringBuilder fragmentsContent = new StringBuilder(
|
StringBuilder fragmentsContent = new StringBuilder(
|
||||||
header +
|
header +
|
||||||
"#include \"pch.h\"\n" +
|
"#include \"pch.h\"\n" +
|
||||||
"#include \"FragmentEntry.h\"\n\n" +
|
"#include \"FragmentEntry.h\"\n\n" +
|
||||||
"#include \"tunerstudio.h\"\n" +
|
"#include \"tunerstudio.h\"\n" +
|
||||||
"/*\n" +
|
"static FragmentEntry fragments[" + liveDocs.size() + "];\n\n" +
|
||||||
"static FragmentEntry fragments[] = {\n");
|
"void initFragments() {\n");
|
||||||
|
|
||||||
|
int index = 0;
|
||||||
|
|
||||||
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);
|
||||||
|
@ -65,11 +67,14 @@ public class UsagesReader {
|
||||||
enumContent.append(enumName + ",\n");
|
enumContent.append(enumName + ",\n");
|
||||||
|
|
||||||
fragmentsContent
|
fragmentsContent
|
||||||
.append("\tFragmentEntry((const uint8_t *)getStructAddr(")
|
.append("\tfragments[")
|
||||||
|
.append(index++)
|
||||||
|
.append("].init(")
|
||||||
|
.append("(const uint8_t *)getStructAddr(")
|
||||||
.append(enumName)
|
.append(enumName)
|
||||||
.append("), sizeof(")
|
.append("), sizeof(")
|
||||||
.append(type)
|
.append(type)
|
||||||
.append(")),\n");
|
.append("));\n");
|
||||||
}
|
}
|
||||||
enumContent.append("} live_data_e;\n");
|
enumContent.append("} live_data_e;\n");
|
||||||
|
|
||||||
|
@ -79,8 +84,6 @@ public class UsagesReader {
|
||||||
|
|
||||||
fragmentsContent.append("};\n");
|
fragmentsContent.append("};\n");
|
||||||
|
|
||||||
fragmentsContent.append("*/\n");
|
|
||||||
|
|
||||||
try (FileWriter fw = new FileWriter("console/binary/generated/live_data_fragments.cpp")) {
|
try (FileWriter fw = new FileWriter("console/binary/generated/live_data_fragments.cpp")) {
|
||||||
fw.write(fragmentsContent.toString());
|
fw.write(fragmentsContent.toString());
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue