From 1491d3b23601c78e1dbef04557a4dabe04dcdd81 Mon Sep 17 00:00:00 2001 From: Damjan Adamic Date: Sat, 17 May 2014 19:38:23 +0200 Subject: [PATCH] Renamed lswReset() to logicalSwitchesReset() Added PACKED to logical switches data structures --- radio/src/gtests.cpp | 2 +- radio/src/opentx.cpp | 2 +- radio/src/opentx.h | 2 +- radio/src/switches.cpp | 10 +++++----- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/radio/src/gtests.cpp b/radio/src/gtests.cpp index b33f795d5..a54110ee3 100644 --- a/radio/src/gtests.cpp +++ b/radio/src/gtests.cpp @@ -53,7 +53,7 @@ void doMixerCalculations(); memset(act, 0, sizeof(act)); \ memset(swOn, 0, sizeof(swOn)); \ int32_t lastAct = 0; lastAct = lastAct; /* to avoid a warning */ \ - lswReset(); + logicalSwitchesReset(); uint16_t anaInValues[NUM_STICKS+NUM_POTS] = { 0 }; uint16_t anaIn(uint8_t chan) diff --git a/radio/src/opentx.cpp b/radio/src/opentx.cpp index d07e28a5c..b884d03d0 100644 --- a/radio/src/opentx.cpp +++ b/radio/src/opentx.cpp @@ -1519,7 +1519,7 @@ void flightReset() #if defined(FRSKY) telemetryReset(); #endif - lswReset(); + logicalSwitchesReset(); s_mixer_first_run_done = false; diff --git a/radio/src/opentx.h b/radio/src/opentx.h index 3ccbd0a2b..604d82303 100644 --- a/radio/src/opentx.h +++ b/radio/src/opentx.h @@ -694,7 +694,7 @@ NOINLINE void per10ms(); getvalue_t getValue(uint8_t i); bool getSwitch(int8_t swtch); void lswTimerTick(); -void lswReset(); +void logicalSwitchesReset(); void evalLogicalSwitches(uint8_t mode); void copyLswState(uint8_t oldPhase, uint8_t newPhase); diff --git a/radio/src/switches.cpp b/radio/src/switches.cpp index dec33f1b3..cf8b9bccb 100644 --- a/radio/src/switches.cpp +++ b/radio/src/switches.cpp @@ -38,7 +38,7 @@ #define CS_LAST_VALUE_INIT -32768 -typedef struct { +PACK(typedef struct { uint8_t state:1; #if defined(CPUARM) uint8_t internalState:1; @@ -46,11 +46,11 @@ typedef struct { uint32_t duration; #endif int16_t lastValue; -} lsw_struct; +}) lsw_struct; -typedef struct { +PACK(typedef struct { lsw_struct ls[NUM_LOGICAL_SWITCH]; -} lsw_array; +}) lsw_array; lsw_array lswFm[MAX_FLIGHT_MODES]; @@ -702,7 +702,7 @@ int16_t lswTimerValue(delayval_t val) return (val < -109 ? 129+val : (val < 7 ? (113+val)*5 : (53+val)*10)); } -void lswReset() { +void logicalSwitchesReset() { for (uint8_t fm=0; fm