File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -132,7 +132,7 @@ void SetConfiguration()
132132
133133SensorType GetSensorType ()
134134{
135- return SensorType:: LSU49 ;
135+ return config. sensorType ;
136136}
137137
138138void SetupESRDriver (SensorType)
Original file line number Diff line number Diff line change @@ -151,6 +151,19 @@ void CanRxThread(void*)
151151 SetConfiguration ();
152152 SendAck ();
153153 }
154+ // Set sensor type command?
155+ else if (CAN_ID (frame) == WB_MSG_SET_SENS_TYPE &&
156+ frame.DLC == 2 && frame.data8 [0 ] == BoardGetHwId ())
157+ {
158+ uint8_t type = frame.data8 [1 ];
159+ if ((type <= (uint8_t )SensorType::LSU49_FAE ) &&
160+ (type >= (uint8_t )SensorType::LSU49 )) {
161+ // TODO: check if HW supports this type of sensor
162+ configuration->sensorType = (SensorType)type;
163+ SetConfiguration ();
164+ SendAck ();
165+ }
166+ }
154167 else if (CAN_ID (frame) == WB_MSG_PING && frame.DLC == 1 )
155168 {
156169 // broadcast or with our HW ID
@@ -220,6 +233,9 @@ void SendRusefiFormat(uint8_t ch)
220233 frame.get ().TemperatureC = sampler.GetSensorTemperature ();
221234 bool heaterClosedLoop = heater.IsRunningClosedLoop ();
222235 frame.get ().Valid = (heaterClosedLoop && lambdaValid) ? 0x01 : 0x00 ;
236+ // Sensor type flags
237+ frame.get ().Valid |= (GetSensorType () == SensorType::LSU49 ) ? 0x02 : 0x00 ;
238+ frame.get ().Valid |= (GetSensorType () == SensorType::LSU49_FAE ) ? 0x04 : 0x00 ;
223239 }
224240
225241 if (configuration->afr [ch].RusEfiTxDiag ) {
Original file line number Diff line number Diff line change 1414#define WB_OPCODE_SET_INDEX 4
1515#define WB_OPCODE_ECU_STATUS 5
1616#define WB_OPCODE_PING 6
17+ #define WB_OPCODE_SET_SENS_TYPE 7
1718
1819#define WB_BL_BASE (WB_BL_HEADER << 4 )
1920#define WB_BL_CMD (opcode, extra ) (((WB_BL_BASE | (opcode)) << 16 ) | (extra))
3839#define WB_MGS_ECU_STATUS WB_BL_CMD (WB_OPCODE_ECU_STATUS , 0 )
3940// 0xEF6'0000
4041#define WB_MSG_PING WB_BL_CMD (WB_OPCODE_PING , 0 )
42+ // 0xEF7'0000
43+ #define WB_MSG_SET_SENS_TYPE WB_BL_CMD (WB_OPCODE_SET_SENS_TYPE , 0 )
4144
4245#define WB_DATA_BASE_ADDR 0x190
4346
You can’t perform that action at this time.
0 commit comments