can VSS scaling #253

This commit is contained in:
Matthew Kennedy 2023-09-18 03:50:35 -04:00 committed by rusefillc
parent 229d044711
commit d481c4c271
4 changed files with 6 additions and 3 deletions

View File

@ -431,6 +431,7 @@ static void setDefaultEngineConfiguration() {
engineConfiguration->canSleepPeriodMs = 50;
engineConfiguration->canReadEnabled = true;
engineConfiguration->canWriteEnabled = true;
engineConfiguration->canVssScaling = 1.0f;
// Don't enable, but set default address
engineConfiguration->verboseCanBaseAddress = CAN_DEFAULT_BASE;

View File

@ -82,7 +82,7 @@ void processCanRxVss(const CANRxFrame& frame, efitick_t nowNt) {
}
if (auto speed = processCanRxVssImpl(frame)) {
canSpeed.setValidValue(speed.Value, nowNt);
canSpeed.setValidValue(speed.Value * engineConfiguration->canVssScaling, nowNt);
#if EFI_DYNO_VIEW
updateDynoViewCan();

View File

@ -1548,11 +1548,12 @@ pin_input_mode_e[LUA_DIGITAL_INPUT_COUNT iterate] luaDigitalInputPinModes;
switch_input_pin_e[RANGE_INPUT_COUNT iterate] tcu_rangeInput;
pin_input_mode_e[RANGE_INPUT_COUNT iterate] tcu_rangeInputMode;
uint16_t autoscale canVssScaling;Scale the reported vehicle speed value from CAN. Example: Parameter set to 1.1, CAN VSS reports 50kph, ECU will report 55kph instead.;"ratio", 0.0001, 0, 0.5, 1.5, 4
!
! Just a shortcut to facilitate compatible configuration changes, i.e. a change which does not touch FLASH_DATA_VERSION and thus does not require manual tune migration
!
uint8_t[190] mainUnusedEnd;;"units", 1, 0, 0, 1, 0
uint8_t[186] mainUnusedEnd;;"units", 1, 0, 0, 1, 0
! end of engine_configuration_s
end_struct

View File

@ -3724,7 +3724,8 @@ cmd_set_engine_type_default = "@@TS_IO_TEST_COMMAND_char@@@@ts_command_e_TS_
dialog = speedSensorCan, "CAN Vehicle Speed"
field = "Enable CAN VSS", enableCanVss, { canReadEnabled }
field = "VSS CAN message type", canVssNbcType, { enableCanVss }
field = "CAN VSS type", canVssNbcType, { enableCanVss }
field = "CAN VSS scaling", canVssScaling, { canReadEnabled }
dialog = speedSensorLeft, "", yAxis
panel = speedSensorAnalog, { enableCanVss == 0 }