Whatever we call it, whatever we implement it - we need live data / remote view into rusEFI actual state #3353

progress
This commit is contained in:
rusefillc 2021-10-14 18:50:03 -04:00
parent a5f5ec4029
commit 970d8f7f84
2 changed files with 9 additions and 27 deletions

View File

@ -230,25 +230,25 @@ static void onlineApplyWorkingCopyBytes(uint32_t offset, int count) {
// is negligable comparing with the IO costs?
}
static const void * getStructAddr(int structId) {
static const void * getStructAddr(live_data_e structId) {
switch (structId) {
case LDS_ENGINE_STATE_INDEX:
case LDS_ENGINE:
return static_cast<engine_state2_s*>(&engine->engineState);
case LDS_FUEL_TRIM_STATE_INDEX:
case LDS_FUEL_TRIM:
return static_cast<wall_fuel_state*>(&engine->injectionEvents.elements[0].wallFuel);
case LDS_TRIGGER_CENTRAL_STATE_INDEX:
case LDS_TRIGGER_CENTRAL:
return static_cast<trigger_central_s*>(&engine->triggerCentral);
case LDS_TRIGGER_STATE_STATE_INDEX:
case LDS_TRIGGER_STATE:
return static_cast<trigger_state_s*>(&engine->triggerCentral.triggerState);
case LDS_AC_CONTROL_STATE_INDEX:
case LDS_AC_CONTROL:
return static_cast<ac_control_s*>(&engine->acState);
#if EFI_ELECTRONIC_THROTTLE_BODY
case LDS_ETB_PID_STATE_INDEX:
case LDS_ETB_PID:
return engine->etbControllers[0]->getPidState();
#endif /* EFI_ELECTRONIC_THROTTLE_BODY */
#ifndef EFI_IDLE_CONTROL
case LDS_IDLE_PID_STATE_INDEX:
case LDS_IDLE_PID:
return static_cast<pid_state_s*>(getIdlePid());
#endif /* EFI_IDLE_CONTROL */
@ -265,7 +265,7 @@ static const void * getStructAddr(int structId) {
static void handleGetStructContent(TsChannelBase* tsChannel, int structId, int size) {
tsState.readPageCommandsCounter++;
const void *addr = getStructAddr(structId);
const void *addr = getStructAddr((live_data_e)structId);
if (addr == nullptr) {
// todo: add warning code - unexpected structId
return;

View File

@ -1750,24 +1750,6 @@ end_struct
#define MOCK_PPS_POSITION_COMMAND "mock_pps_position"
#define MOCK_PPS_VOLTAGE_COMMAND "mock_pps_voltage"
! Live Documentation Structure
! todo: kill this nightmare with fire
! we need an explicit C enum header with conversion into proper java enum
#define LDS_SPEED_DENSITY_STATE_INDEX 2
#define LDS_ENGINE_STATE_INDEX 3
#define LDS_FUEL_TRIM_STATE_INDEX 4
#define LDS_TPS_TPS_ENRICHMENT_STATE_INDEX 5
#define LDS_TRIGGER_CENTRAL_STATE_INDEX 6
#define LDS_ETB_PID_STATE_INDEX 7
#define LDS_IDLE_PID_STATE_INDEX 8
#define LDS_ALTERNATOR_PID_STATE_INDEX 9
#define LDS_CJ125_PID_STATE_INDEX 10
#define LDS_TRIGGER_STATE_STATE_INDEX 11
#define LDS_AC_CONTROL_STATE_INDEX 12
#define GAUGE_NAME_VERSION "firmware"
#define GAUGE_NAME_UPTIME "Uptime"
#define GAUGE_NAME_TRG_ERR "trg err"