No invented data: shared structure starts with nothing valid, cleared on CAN stop and bus silence; DEFAULT_* removed from the shared header
Firmware / build (push) Successful in 7m19s
Firmware / build (push) Successful in 7m19s
This commit is contained in:
@@ -50,30 +50,17 @@ static volatile bool g_port_ready = false; // Serial1.begin() done (in the tas
|
||||
// ============================================================================
|
||||
|
||||
/**
|
||||
* @brief Seed the shared structure until CAN data arrives.
|
||||
* @note The temperatures/voltage are marked valid so a bench without CAN still
|
||||
* exercises B's display. RPM and gear nibbles are NOT marked valid: the
|
||||
* tach output must never run on invented data.
|
||||
* @brief Start from NOTHING valid. Until a CAN frame fills a field, its valid
|
||||
* flag stays clear and B shows no value for it (user decision
|
||||
* 2026-09-28: no invented numbers, ever - the old bench defaults of
|
||||
* 89 / 85 degC and 12.45 V looked like real readings).
|
||||
*/
|
||||
static void initializeDefaultData() {
|
||||
if (xSemaphoreTake(g_data_mutex, pdMS_TO_TICKS(100)) == pdTRUE) {
|
||||
g_automotive_data.gear_lever = DEFAULT_GEAR_LEVER;
|
||||
g_automotive_data.gear_nibbles = 0;
|
||||
g_automotive_data.engine_rpm = 0;
|
||||
g_automotive_data.gearbox_oil_temp = DEFAULT_GEARBOX_TEMP;
|
||||
g_automotive_data.engine_oil_temp = DEFAULT_ENGINE_OIL_TEMP;
|
||||
g_automotive_data.coolant_temp = DEFAULT_COOLANT_TEMP;
|
||||
g_automotive_data.battery_voltage = DEFAULT_BATTERY_VOLTAGE;
|
||||
g_automotive_data.alerts = DEFAULT_ALERTS;
|
||||
|
||||
g_automotive_data.valid_flags = VALID_FLAG_GEAR_POS |
|
||||
VALID_FLAG_GEARBOX_TEMP |
|
||||
VALID_FLAG_ENGINE_TEMP |
|
||||
VALID_FLAG_COOLANT_TEMP |
|
||||
VALID_FLAG_BATTERY_VOLT |
|
||||
VALID_FLAG_ALERTS;
|
||||
|
||||
g_automotive_data.debug_enabled = 0;
|
||||
uint8_t dbg = g_automotive_data.debug_enabled;
|
||||
memset(&g_automotive_data, 0, sizeof(g_automotive_data));
|
||||
g_automotive_data.gear_lever = LEVER_UNKNOWN;
|
||||
g_automotive_data.debug_enabled = dbg;
|
||||
xSemaphoreGive(g_data_mutex);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user