Save/restore previous module power state after SPORT upgrade
This commit is contained in:
@@ -177,6 +177,8 @@ uint32_t isBootloaderStart(const void * buffer);
|
|||||||
#define INTERNAL_MODULE_OFF() GPIO_ResetBits(GPIO_INT_RF_PWR, PIN_INT_RF_PWR)
|
#define INTERNAL_MODULE_OFF() GPIO_ResetBits(GPIO_INT_RF_PWR, PIN_INT_RF_PWR)
|
||||||
#define EXTERNAL_MODULE_ON() GPIO_SetBits(GPIO_EXT_RF_PWR, PIN_EXT_RF_PWR)
|
#define EXTERNAL_MODULE_ON() GPIO_SetBits(GPIO_EXT_RF_PWR, PIN_EXT_RF_PWR)
|
||||||
#define EXTERNAL_MODULE_OFF() GPIO_ResetBits(GPIO_EXT_RF_PWR, PIN_EXT_RF_PWR)
|
#define EXTERNAL_MODULE_OFF() GPIO_ResetBits(GPIO_EXT_RF_PWR, PIN_EXT_RF_PWR)
|
||||||
|
#define INERNAL_MODULE_PWR() (GPIO_ReadInputDataBit(GPIO_INT_RF_PWR, PIN_INT_RF_PWR) == Bit_SET)
|
||||||
|
#define EXTERNAL_MODULE_PWR() (GPIO_ReadInputDataBit(GPIO_EXT_RF_PWR, PIN_EXT_RF_PWR) == Bit_SET)
|
||||||
void init_no_pulses(uint32_t port);
|
void init_no_pulses(uint32_t port);
|
||||||
void disable_no_pulses(uint32_t port);
|
void disable_no_pulses(uint32_t port);
|
||||||
void init_ppm( uint32_t module_index );
|
void init_ppm( uint32_t module_index );
|
||||||
|
|||||||
@@ -123,6 +123,7 @@ enum SportUpdateState {
|
|||||||
|
|
||||||
uint8_t sportUpdateState = SPORT_IDLE;
|
uint8_t sportUpdateState = SPORT_IDLE;
|
||||||
uint32_t sportUpdateAddr = 0;
|
uint32_t sportUpdateAddr = 0;
|
||||||
|
bool intPwr, extPwr;
|
||||||
|
|
||||||
void processSportUpdatePacket(uint8_t *packet)
|
void processSportUpdatePacket(uint8_t *packet)
|
||||||
{
|
{
|
||||||
@@ -362,6 +363,8 @@ bool sportUpdatePowerOn(ModuleIndex module)
|
|||||||
sportUpdateState = SPORT_POWERUP_REQ;
|
sportUpdateState = SPORT_POWERUP_REQ;
|
||||||
|
|
||||||
#if defined(PCBTARANIS)
|
#if defined(PCBTARANIS)
|
||||||
|
intPwr = INERNAL_MODULE_PWR();
|
||||||
|
extPwr = EXTERNAL_MODULE_PWR();
|
||||||
INTERNAL_MODULE_OFF();
|
INTERNAL_MODULE_OFF();
|
||||||
EXTERNAL_MODULE_OFF();
|
EXTERNAL_MODULE_OFF();
|
||||||
#endif
|
#endif
|
||||||
@@ -484,12 +487,19 @@ void sportFirmwareUpdate(ModuleIndex module, const char *filename)
|
|||||||
if (result == false) {
|
if (result == false) {
|
||||||
POPUP_WARNING("Firmware Update Error");
|
POPUP_WARNING("Firmware Update Error");
|
||||||
}
|
}
|
||||||
sportUpdateState = SPORT_IDLE;
|
|
||||||
|
|
||||||
#if defined(PCBTARANIS)
|
#if defined(PCBTARANIS)
|
||||||
INTERNAL_MODULE_OFF();
|
INTERNAL_MODULE_OFF();
|
||||||
EXTERNAL_MODULE_OFF();
|
EXTERNAL_MODULE_OFF();
|
||||||
|
|
||||||
|
sportWaitState(SPORT_IDLE, 1000);
|
||||||
|
|
||||||
|
if (intPwr)
|
||||||
|
INTERNAL_MODULE_ON();
|
||||||
|
if (extPwr)
|
||||||
|
EXTERNAL_MODULE_ON();
|
||||||
#endif
|
#endif
|
||||||
|
sportUpdateState = SPORT_IDLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user