Skip to content

Commit

Permalink
add getCoreTemp (betaflight#12608)
Browse files Browse the repository at this point in the history
* add getCoreTemp

* add ifdef

* Update msp.c

Now also repported from MSP_STATUS

* Update src/main/msp/msp.c

Co-authored-by: Míguel Ángel Mulero Martínez <mcgivergim@gmail.com>

---------

Co-authored-by: Míguel Ángel Mulero Martínez <mcgivergim@gmail.com>
  • Loading branch information
2 people authored and davidbitton committed Feb 5, 2024
1 parent 3d69605 commit 1fb0a70
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
9 changes: 9 additions & 0 deletions src/main/msp/msp.c
Expand Up @@ -138,6 +138,7 @@
#include "scheduler/scheduler.h"

#include "sensors/acceleration.h"
#include "sensors/adcinternal.h"
#include "sensors/barometer.h"
#include "sensors/battery.h"
#include "sensors/boardalignment.h"
Expand Down Expand Up @@ -1116,6 +1117,14 @@ static bool mspProcessOutCommand(mspDescriptor_t srcDesc, int16_t cmdMSP, sbuf_t
// config state flags - bits to indicate the state of the configuration, reboot required, etc.
// other flags can be added as needed
sbufWriteU8(dst, (getRebootRequired() << 0));

// Added in API version 1.46
// Write CPU temp
#ifdef USE_ADC_INTERNAL
sbufWriteU16(dst, getCoreTemperatureCelsius());
#else
sbufWriteU16(dst, 0);
#endif
}
break;

Expand Down
2 changes: 1 addition & 1 deletion src/main/msp/msp_protocol.h
Expand Up @@ -336,7 +336,7 @@
#define MSP_V2_FRAME 255 //MSPv2 payload indicator

// Additional commands that are not compatible with MultiWii
#define MSP_STATUS_EX 150 //out message cycletime, errors_count, CPU load, sensor present etc
#define MSP_STATUS_EX 150 //out message cycletime, errors_count, CPU load, CPU temperature, sensor present etc
#define MSP_UID 160 //out message Unique device ID
#define MSP_GPSSVINFO 164 //out message get Signal Strength (only U-Blox)
#define MSP_GPSSTATISTICS 166 //out message get GPS debugging data
Expand Down

0 comments on commit 1fb0a70

Please sign in to comment.