1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-19 06:15:16 +03:00

Reorganised static variables in SmartPort code.

This commit is contained in:
mikeller 2018-05-20 00:55:07 +12:00
parent 0ded96910d
commit 847e050955

View file

@ -455,6 +455,13 @@ static void smartPortSendMspResponse(uint8_t *data) {
void processSmartPortTelemetry(smartPortPayload_t *payload, volatile bool *clearToSend, const uint32_t *requestTimeout) void processSmartPortTelemetry(smartPortPayload_t *payload, volatile bool *clearToSend, const uint32_t *requestTimeout)
{ {
static uint8_t smartPortIdCycleCnt = 0;
static uint8_t t1Cnt = 0;
static uint8_t t2Cnt = 0;
#ifdef USE_ESC_SENSOR
static uint8_t smartPortIdOffset = 0;
#endif
if (payload) { if (payload) {
// do not check the physical ID here again // do not check the physical ID here again
// unless we start receiving other sensors' packets // unless we start receiving other sensors' packets
@ -493,14 +500,12 @@ void processSmartPortTelemetry(smartPortPayload_t *payload, volatile bool *clear
// we can send back any data we want, our tables keep track of the order and frequency of each data type we send // we can send back any data we want, our tables keep track of the order and frequency of each data type we send
frSkyTableInfo_t * tableInfo = &frSkyDataIdTableInfo; frSkyTableInfo_t * tableInfo = &frSkyDataIdTableInfo;
static uint8_t smartPortIdCycleCnt = 0;
if (smartPortIdCycleCnt % SENSOR_REST_PERIOD == 0) { if (smartPortIdCycleCnt % SENSOR_REST_PERIOD == 0) {
smartPortIdCycleCnt++; smartPortIdCycleCnt++;
return; return;
} }
#ifdef USE_ESC_SENSOR #ifdef USE_ESC_SENSOR
static uint8_t smartPortIdOffset = 0;
if (smartPortIdCycleCnt >= ESC_SENSOR_PERIOD) { if (smartPortIdCycleCnt >= ESC_SENSOR_PERIOD) {
// send ESC sensors // send ESC sensors
tableInfo = &frSkyEscDataIdTableInfo; tableInfo = &frSkyEscDataIdTableInfo;
@ -534,8 +539,6 @@ void processSmartPortTelemetry(smartPortPayload_t *payload, volatile bool *clear
int32_t tmpi; int32_t tmpi;
uint32_t tmp2 = 0; uint32_t tmp2 = 0;
static uint8_t t1Cnt = 0;
static uint8_t t2Cnt = 0;
uint16_t vfasVoltage; uint16_t vfasVoltage;
uint8_t cellCount; uint8_t cellCount;