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