Skip to content

Commit

Permalink
can VSS scaling #253
Browse files Browse the repository at this point in the history
  • Loading branch information
mck1117 committed Sep 18, 2023
1 parent 36d3680 commit 21024e1
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 3 deletions.
1 change: 1 addition & 0 deletions firmware/controllers/algo/engine_configuration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -408,6 +408,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;
Expand Down
2 changes: 1 addition & 1 deletion firmware/controllers/can/can_vss.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,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();
Expand Down
4 changes: 3 additions & 1 deletion firmware/integration/rusefi_config.txt
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@
! Any time an incompatible change is made to the configuration format stored in flash,
! update this string to the current date! It is required to also update TS_SIGNATURE above
! when this happens.
#define FLASH_DATA_VERSION 20011
#define FLASH_DATA_VERSION 20012

! this offset is part of console compatibility mechanism, please DO NOT change this offset
#define TS_FILE_VERSION_OFFSET 124
Expand Down Expand Up @@ -1475,6 +1475,8 @@ pin_input_mode_e[LUA_DIGITAL_INPUT_COUNT iterate] luaDigitalInputPinModes;
uint8_t ignTestCount;How many test bench pulses do you want;"", 1, 0, 0, 50, 0
uint8_t autoscale ignTestOffTime;Time between bench test pulses;"ms", 5, 0, 0, 2000, 0

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

uint8_t[93] mainUnusedEnd;;"units", 1, 0, 0, 1, 0

! end of engine_configuration_s
Expand Down
3 changes: 2 additions & 1 deletion firmware/tunerstudio/rusefi.input
Original file line number Diff line number Diff line change
Expand Up @@ -3549,7 +3549,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 }
Expand Down

0 comments on commit 21024e1

Please sign in to comment.