Bsongis/gui refactoring for x7 d (#3701)
* [X7D] New board added * Cosmetics
This commit is contained in:
@@ -57,7 +57,7 @@ NOINLINE void processFrskyTelemetryData(uint8_t data)
|
||||
btPushByte(data);
|
||||
#endif
|
||||
|
||||
#if defined(PCBTARANIS)
|
||||
#if defined(SERIAL2)
|
||||
if (g_eeGeneral.serial2Mode == UART_MODE_TELEMETRY_MIRROR) {
|
||||
serial2Putc(data);
|
||||
}
|
||||
|
||||
@@ -229,7 +229,7 @@ void processSportPacket(uint8_t * packet)
|
||||
uint16_t id = *((uint16_t *)(packet+2));
|
||||
uint32_t data = SPORT_DATA_S32(packet);
|
||||
|
||||
#if defined(CPUSTM32) && !defined(SIMU)
|
||||
#if defined(STM32) && !defined(SIMU)
|
||||
if (sportUpdateState != SPORT_IDLE) {
|
||||
processSportUpdatePacket(packet); // Uses different chksum
|
||||
return;
|
||||
@@ -388,7 +388,7 @@ void frskySportSetDefault(int index, uint16_t id, uint8_t subId, uint8_t instanc
|
||||
storageDirty(EE_MODEL);
|
||||
}
|
||||
|
||||
#if defined(CPUSTM32)
|
||||
#if defined(STM32)
|
||||
bool sportWaitState(SportUpdateState state, int timeout)
|
||||
{
|
||||
#if defined(SIMU)
|
||||
|
||||
@@ -28,10 +28,10 @@ void telemetryInterrupt10ms()
|
||||
{
|
||||
if (jetiReady) {
|
||||
jetiKeys = JETI_KEY_NOCHANGE;
|
||||
if (switchState((EnumKeys)(KEY_UP))) jetiKeys &= JETI_KEY_UP;
|
||||
if (switchState((EnumKeys)(KEY_DOWN))) jetiKeys &= JETI_KEY_DOWN;
|
||||
if (switchState((EnumKeys)(KEY_LEFT))) jetiKeys &= JETI_KEY_LEFT;
|
||||
if (switchState((EnumKeys)(KEY_RIGHT))) jetiKeys &= JETI_KEY_RIGHT;
|
||||
if (switchState(KEY_UP)) jetiKeys &= JETI_KEY_UP;
|
||||
if (switchState(KEY_DOWN)) jetiKeys &= JETI_KEY_DOWN;
|
||||
if (switchState(KEY_LEFT)) jetiKeys &= JETI_KEY_LEFT;
|
||||
if (switchState(KEY_RIGHT)) jetiKeys &= JETI_KEY_RIGHT;
|
||||
|
||||
jetiReady = 0; // invalidate buffer
|
||||
|
||||
@@ -192,7 +192,7 @@ void JETI_put_stop (void)
|
||||
|
||||
void menuViewTelemetryJeti(uint8_t event)
|
||||
{
|
||||
lcdDrawTelemetryTopBar();
|
||||
drawTelemetryTopBar();
|
||||
|
||||
for (uint8_t i=0; i<16; i++) {
|
||||
lcdDrawChar((i+2)*FW, 3*FH, jetiRxBuffer[i], BSS);
|
||||
|
||||
@@ -460,7 +460,7 @@ void menuViewTelemetryNMEA1(uint8_t event)
|
||||
if ((show_timer == 1) && rbuf[0][0]) { // show the Timer when data have been received
|
||||
|
||||
lcd_puts ( 2*FW, 4*FH, PSTR("Timer")); // display "Timer"
|
||||
putsTimer ( 5*FW, 5*FH, (gpstime-gpstimer), DBLSIZE, DBLSIZE); // display difference as mm:ss
|
||||
drawTimer ( 5*FW, 5*FH, (gpstime-gpstimer), DBLSIZE, DBLSIZE); // display difference as mm:ss
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -56,7 +56,7 @@ lcdint_t applyChannelRatio(source_t channel, lcdint_t val)
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(CPUSTM32)
|
||||
#if defined(STM32)
|
||||
#define IS_TELEMETRY_INTERNAL_MODULE (g_model.moduleData[INTERNAL_MODULE].rfProtocol != RF_PROTO_OFF)
|
||||
#else
|
||||
#define IS_TELEMETRY_INTERNAL_MODULE (false)
|
||||
@@ -96,7 +96,7 @@ void telemetryWakeup()
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(CPUSTM32)
|
||||
#if defined(STM32)
|
||||
uint8_t data;
|
||||
if (!telemetryFifo.isEmpty()) {
|
||||
LOG_TELEMETRY_WRITE_START();
|
||||
@@ -132,7 +132,7 @@ void telemetryWakeup()
|
||||
#endif
|
||||
|
||||
#if defined(CPUARM)
|
||||
for (int i=0; i<MAX_SENSORS; i++) {
|
||||
for (int i=0; i<MAX_TELEMETRY_SENSORS; i++) {
|
||||
const TelemetrySensor & sensor = g_model.telemetrySensors[i];
|
||||
if (sensor.type == TELEM_TYPE_CALCULATED) {
|
||||
telemetryItems[i].eval(sensor);
|
||||
@@ -157,7 +157,7 @@ void telemetryWakeup()
|
||||
|
||||
uint8_t now = TelemetryItem::now();
|
||||
bool sensor_lost = false;
|
||||
for (int i=0; i<MAX_SENSORS; i++) {
|
||||
for (int i=0; i<MAX_TELEMETRY_SENSORS; i++) {
|
||||
if (isTelemetryFieldAvailable(i)) {
|
||||
uint8_t lastReceived = telemetryItems[i].lastReceived;
|
||||
if (lastReceived < TELEMETRY_VALUE_TIMER_CYCLE && uint8_t(now - lastReceived) > TELEMETRY_VALUE_OLD_THRESHOLD) {
|
||||
@@ -226,7 +226,7 @@ void telemetryInterrupt10ms()
|
||||
if (TELEMETRY_STREAMING()) {
|
||||
if (!TELEMETRY_OPENXSENSOR()) {
|
||||
#if defined(CPUARM)
|
||||
for (int i=0; i<MAX_SENSORS; i++) {
|
||||
for (int i=0; i<MAX_TELEMETRY_SENSORS; i++) {
|
||||
const TelemetrySensor & sensor = g_model.telemetrySensors[i];
|
||||
if (sensor.type == TELEM_TYPE_CALCULATED) {
|
||||
telemetryItems[i].per10ms(sensor);
|
||||
@@ -299,7 +299,7 @@ void telemetryReset()
|
||||
memclear(&telemetryData, sizeof(telemetryData));
|
||||
|
||||
#if defined(CPUARM)
|
||||
for (int index=0; index<MAX_SENSORS; index++) {
|
||||
for (int index=0; index<MAX_TELEMETRY_SENSORS; index++) {
|
||||
telemetryItems[index].clear();
|
||||
}
|
||||
#endif
|
||||
@@ -382,7 +382,7 @@ void telemetryReset()
|
||||
|
||||
/*Add some default sensor values to the simulator*/
|
||||
#if defined(CPUARM) && defined(SIMU)
|
||||
for (int i=0; i<MAX_SENSORS; i++) {
|
||||
for (int i=0; i<MAX_TELEMETRY_SENSORS; i++) {
|
||||
const TelemetrySensor & sensor = g_model.telemetrySensors[i];
|
||||
switch (sensor.id)
|
||||
{
|
||||
@@ -429,10 +429,12 @@ void telemetryInit(uint8_t protocol) {
|
||||
telemetryPortSetDirectionOutput();
|
||||
}
|
||||
#endif
|
||||
#if defined(SERIAL2)
|
||||
else if (protocol == PROTOCOL_FRSKY_D_SECONDARY) {
|
||||
telemetryPortInit(0, TELEMETRY_SERIAL_8N1);
|
||||
serial2TelemetryInit(PROTOCOL_FRSKY_D_SECONDARY);
|
||||
}
|
||||
#endif
|
||||
else {
|
||||
telemetryPortInit(FRSKY_SPORT_BAUDRATE, TELEMETRY_SERIAL_8N1);
|
||||
#if defined(LUA)
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
|
||||
#include "opentx.h"
|
||||
|
||||
TelemetryItem telemetryItems[MAX_SENSORS];
|
||||
TelemetryItem telemetryItems[MAX_TELEMETRY_SENSORS];
|
||||
uint8_t allowNewSensors;
|
||||
|
||||
// TODO in maths
|
||||
@@ -214,7 +214,7 @@ void TelemetryItem::setValue(const TelemetrySensor & sensor, int32_t val, uint32
|
||||
}
|
||||
}
|
||||
|
||||
for (int i=0; i<MAX_SENSORS; i++) {
|
||||
for (int i=0; i<MAX_TELEMETRY_SENSORS; i++) {
|
||||
TelemetrySensor & it = g_model.telemetrySensors[i];
|
||||
if (it.type == TELEM_TYPE_CALCULATED && it.formula == TELEM_FORMULA_TOTALIZE && &g_model.telemetrySensors[it.consumption.source-1] == &sensor) {
|
||||
TelemetryItem & item = telemetryItems[i];
|
||||
@@ -443,7 +443,7 @@ void delTelemetryIndex(uint8_t index)
|
||||
|
||||
int availableTelemetryIndex()
|
||||
{
|
||||
for (int index=0; index<MAX_SENSORS; index++) {
|
||||
for (int index=0; index<MAX_TELEMETRY_SENSORS; index++) {
|
||||
TelemetrySensor & telemetrySensor = g_model.telemetrySensors[index];
|
||||
if (!telemetrySensor.isAvailable()) {
|
||||
return index;
|
||||
@@ -454,7 +454,7 @@ int availableTelemetryIndex()
|
||||
|
||||
int lastUsedTelemetryIndex()
|
||||
{
|
||||
for (int index=MAX_SENSORS-1; index>=0; index--) {
|
||||
for (int index=MAX_TELEMETRY_SENSORS-1; index>=0; index--) {
|
||||
TelemetrySensor & telemetrySensor = g_model.telemetrySensors[index];
|
||||
if (telemetrySensor.isAvailable()) {
|
||||
return index;
|
||||
@@ -467,7 +467,7 @@ void setTelemetryValue(TelemetryProtocol protocol, uint16_t id, uint8_t subId, u
|
||||
{
|
||||
bool available = false;
|
||||
|
||||
for (int index=0; index<MAX_SENSORS; index++) {
|
||||
for (int index=0; index<MAX_TELEMETRY_SENSORS; index++) {
|
||||
TelemetrySensor & telemetrySensor = g_model.telemetrySensors[index];
|
||||
if (telemetrySensor.type == TELEM_TYPE_CUSTOM && telemetrySensor.id == id && telemetrySensor.subId == subId && (telemetrySensor.instance == instance || g_model.ignoreSensorIds)) {
|
||||
telemetryItems[index].setValue(telemetrySensor, value, unit, prec);
|
||||
|
||||
@@ -99,7 +99,7 @@ class TelemetryItem
|
||||
void gpsReceived();
|
||||
};
|
||||
|
||||
extern TelemetryItem telemetryItems[MAX_SENSORS];
|
||||
extern TelemetryItem telemetryItems[MAX_TELEMETRY_SENSORS];
|
||||
extern uint8_t allowNewSensors;
|
||||
|
||||
#endif // _TELEMETRY_SENSORS_H_
|
||||
|
||||
Reference in New Issue
Block a user