@@ -302,35 +302,18 @@ void crsfSensorEncodeEscRpm(telemetrySensor_t *sensor, sbuf_t *buf)
302302 }
303303}
304304
305- void crsfSensorEncodeEscTemp (telemetrySensor_t * sensor , sbuf_t * buf )
306- {
305+ void crsfSensorEncodeEscTemp (telemetrySensor_t * sensor , sbuf_t * buf ) {
307306 UNUSED (sensor );
308307 uint8_t motorCount = MAX (getMotorCount (), 1 ); //must send at least one motor, to avoid CRSF frame shifting
309308 motorCount = MIN (getMotorCount (), CRSF_PAYLOAD_SIZE_MAX / 3 ); // 3 bytes per RPM value
310309 motorCount = MIN (motorCount , MAX_SUPPORTED_MOTORS ); // ensure we don't exceed available ESC telemetry data
311310
312311 for (uint8_t i = 0 ; i < motorCount ; i ++ ) {
313312 const escSensorData_t * escState = getEscTelemetry (i );
314- crsfSerialize16BE (buf , escState -> temperature & 0xFFFF );
313+ uint32_t temp = (escState ) ? (escState -> temperature * 10 ) & 0xFFFFFF : TEMPERATURE_INVALID_VALUE ;
314+ crsfSerialize24BE (buf , temp );
315315 }
316316}
317-
318- void crsfSensorEncodeEscTemperature (telemetrySensor_t * sensor , sbuf_t * buf )
319- {
320- UNUSED (sensor );
321-
322- uint8_t motorCount = MAX (getMotorCount (), 1 ); //must send at least one motor, to avoid CRSF frame shifting
323- motorCount = MIN (getMotorCount (), CRSF_PAYLOAD_SIZE_MAX / 3 ); // 3 bytes per RPM value
324- motorCount = MIN (motorCount , MAX_SUPPORTED_MOTORS ); // ensure we don't exceed available ESC telemetry data
325-
326- for (uint8_t i = 0 ; i < motorCount ; i ++ ) {
327- const escSensorData_t * escState = getEscTelemetry (i );
328- uint32_t rpm = (escState ) ? (escState -> temperature * 10 ) & 0xFFFFFF : TEMPERATURE_INVALID_VALUE ;
329- crsfSerialize24BE (buf , rpm );
330- }
331-
332- }
333-
334317#endif // USE_CUSTOM_TELEMETRY
335318
336319///////////////////////////////////////////////////////////////////////////////////////////
0 commit comments