Add support for pwr-on and power-off speed

This commit is contained in:
Raphael Coeffic
2019-08-16 21:02:47 +02:00
parent 8d9a7c22e6
commit 995888ae41
32 changed files with 927 additions and 739 deletions
+18
View File
@@ -78,6 +78,8 @@ enum MenuRadioSetupItems {
CASE_PCBX9E_PCBX9DP(ITEM_RADIO_SETUP_BACKLIGHT_COLOR)
ITEM_RADIO_SETUP_FLASH_BEEP,
CASE_SPLASH_PARAM(ITEM_RADIO_SETUP_DISABLE_SPLASH)
CASE_PWR_BUTTON_PRESS(ITEM_RADIO_SETUP_PWR_ON_SPEED)
CASE_PWR_BUTTON_PRESS(ITEM_RADIO_SETUP_PWR_OFF_SPEED)
#if defined(PXX2)
ITEM_RADIO_SETUP_OWNER_ID,
#endif
@@ -155,6 +157,8 @@ void menuRadioSetup(event_t event)
CASE_PCBX9E_PCBX9DP(0) // backlight color
0, // flash beep
CASE_SPLASH_PARAM(0) // disable splash
CASE_PWR_BUTTON_PRESS(0) // pwr on speed
CASE_PWR_BUTTON_PRESS(0) // pwr off speed
CASE_PXX2(0)
CASE_GPS(LABEL(GPS))
CASE_GPS(0) // timezone
@@ -466,6 +470,20 @@ void menuRadioSetup(event_t event)
break;
#endif
#if defined(PWR_BUTTON_PRESS)
case ITEM_RADIO_SETUP_PWR_ON_SPEED:
lcdDrawTextAlignedLeft(y, STR_PWR_ON_SPEED);
lcdDrawNumber(RADIO_SETUP_2ND_COLUMN, y, g_eeGeneral.pwrOnSpeed, attr|LEFT);
if (attr) CHECK_INCDEC_GENVAR(event, g_eeGeneral.pwrOnSpeed, 0, 3);
break;
case ITEM_RADIO_SETUP_PWR_OFF_SPEED:
lcdDrawTextAlignedLeft(y, STR_PWR_OFF_SPEED);
lcdDrawNumber(RADIO_SETUP_2ND_COLUMN, y, g_eeGeneral.pwrOffSpeed, attr|LEFT);
if (attr) CHECK_INCDEC_GENVAR(event, g_eeGeneral.pwrOffSpeed, 0, 3);
break;
#endif
#if defined(TELEMETRY_FRSKY) && defined(GPS)
case ITEM_RADIO_SETUP_LABEL_GPS:
lcdDrawTextAlignedLeft(y, STR_GPS);
+8 -6
View File
@@ -20,8 +20,6 @@
#include "opentx.h"
#define PWR_PRESS_DURATION_MIN 100 // 1s
#define PWR_PRESS_DURATION_MAX 500 // 5s
#define ANIMATIONS_BITMAP_WIDTH 60
#define ANIMATIONS_BITMAP_HEIGHT 60
@@ -42,9 +40,11 @@ const unsigned char bmp_sleep[] = {
#include "sleep.lbm"
};
void drawStartupAnimation(uint32_t duration)
void drawStartupAnimation(uint32_t duration, uint32_t total_duration)
{
uint8_t index = limit<uint8_t>(0, duration / (PWR_PRESS_DURATION_MIN / 5), 4);
if (total_duration == 0) return;
uint8_t index = limit<uint8_t>(0, duration / (total_duration / 5), 4);
lcdRefreshWait();
lcdClear();
@@ -57,9 +57,11 @@ void drawStartupAnimation(uint32_t duration)
lcdRefresh();
}
void drawShutdownAnimation(uint32_t duration, const char * message)
void drawShutdownAnimation(uint32_t duration, uint32_t total_duration, const char * message)
{
uint8_t index = limit<uint8_t>(0, duration / (PWR_PRESS_SHUTDOWN_DELAY / 4), 3);
if (total_duration == 0) return;
uint8_t index = limit<uint8_t>(0, duration / (total_duration / 4), 3);
lcdRefreshWait();
lcdClear();