mirror of
https://github.com/opentx/opentx.git
synced 2025-07-24 00:35:18 +03:00
[Horus] Refactoring continued
This commit is contained in:
parent
c8f77fceec
commit
e18e6f9c41
51 changed files with 376 additions and 753 deletions
Binary file not shown.
Before Width: | Height: | Size: 453 B |
Binary file not shown.
Before Width: | Height: | Size: 852 B |
Binary file not shown.
Before Width: | Height: | Size: 520 B |
Binary file not shown.
Before Width: | Height: | Size: 318 B |
Before Width: | Height: | Size: 494 B After Width: | Height: | Size: 494 B |
|
@ -39,6 +39,7 @@
|
||||||
|
|
||||||
#define NUM_BODY_LINES (LCD_LINES-1)
|
#define NUM_BODY_LINES (LCD_LINES-1)
|
||||||
#define MENU_HEADER_HEIGHT FH
|
#define MENU_HEADER_HEIGHT FH
|
||||||
|
#define MENU_INIT_VPOS 0
|
||||||
|
|
||||||
void displaySplash();
|
void displaySplash();
|
||||||
void displayScreenIndex(uint8_t index, uint8_t count, uint8_t attr);
|
void displayScreenIndex(uint8_t index, uint8_t count, uint8_t attr);
|
||||||
|
|
|
@ -38,7 +38,7 @@
|
||||||
|
|
||||||
display_t displayBuf[DISPLAY_BUFFER_SIZE];
|
display_t displayBuf[DISPLAY_BUFFER_SIZE];
|
||||||
|
|
||||||
void lcd_clear()
|
void lcdClear()
|
||||||
{
|
{
|
||||||
memset(displayBuf, 0, DISPLAY_BUFFER_SIZE);
|
memset(displayBuf, 0, DISPLAY_BUFFER_SIZE);
|
||||||
}
|
}
|
||||||
|
|
|
@ -255,7 +255,7 @@ void lcdDrawTelemetryTopBar();
|
||||||
void lcd_img(coord_t x, coord_t y, const pm_uchar * img, uint8_t idx, LcdFlags att=0);
|
void lcd_img(coord_t x, coord_t y, const pm_uchar * img, uint8_t idx, LcdFlags att=0);
|
||||||
|
|
||||||
void lcdSetRefVolt(unsigned char val);
|
void lcdSetRefVolt(unsigned char val);
|
||||||
void lcd_clear();
|
void lcdClear();
|
||||||
void lcdSetContrast();
|
void lcdSetContrast();
|
||||||
void lcdInit();
|
void lcdInit();
|
||||||
#define lcdOff()
|
#define lcdOff()
|
||||||
|
|
|
@ -70,8 +70,6 @@ typedef void (*MenuFuncP)(uint8_t event);
|
||||||
typedef void (*MenuFuncP_PROGMEM)(uint8_t event);
|
typedef void (*MenuFuncP_PROGMEM)(uint8_t event);
|
||||||
extern const MenuFuncP_PROGMEM menuTabModel[];
|
extern const MenuFuncP_PROGMEM menuTabModel[];
|
||||||
extern const MenuFuncP_PROGMEM menuTabGeneral[];
|
extern const MenuFuncP_PROGMEM menuTabGeneral[];
|
||||||
extern const MenuFuncP_PROGMEM menuTabFPV[];
|
|
||||||
extern const MenuFuncP_PROGMEM menuTabTelemetry[];
|
|
||||||
|
|
||||||
extern MenuFuncP g_menuStack[5];
|
extern MenuFuncP g_menuStack[5];
|
||||||
extern uint8_t g_menuPos[4];
|
extern uint8_t g_menuPos[4];
|
||||||
|
@ -274,19 +272,11 @@ void title(const pm_char * s);
|
||||||
#define MENU_CHECK(tab, menu, lines_count) \
|
#define MENU_CHECK(tab, menu, lines_count) \
|
||||||
check(event, menu, tab, DIM(tab), mstate_tab, DIM(mstate_tab)-1, (lines_count)-1)
|
check(event, menu, tab, DIM(tab), mstate_tab, DIM(mstate_tab)-1, (lines_count)-1)
|
||||||
|
|
||||||
#define MENU_CHECK_FLAGS(tab, menu, flags, lines_count) \
|
|
||||||
check(event, menu, tab, DIM(tab), mstate_tab, DIM(mstate_tab)-1, (lines_count)-1, flags)
|
|
||||||
|
|
||||||
#define MENU(title, tab, menu, lines_count, ...) \
|
#define MENU(title, tab, menu, lines_count, ...) \
|
||||||
MENU_TAB(__VA_ARGS__); \
|
MENU_TAB(__VA_ARGS__); \
|
||||||
MENU_CHECK(tab, menu, lines_count); \
|
MENU_CHECK(tab, menu, lines_count); \
|
||||||
TITLE(title)
|
TITLE(title)
|
||||||
|
|
||||||
#define MENU_FLAGS(title, tab, menu, flags, lines_count, ...) \
|
|
||||||
MENU_TAB(__VA_ARGS__); \
|
|
||||||
MENU_CHECK_FLAGS(tab, menu, flags, lines_count); \
|
|
||||||
TITLE(title)
|
|
||||||
|
|
||||||
#define SIMPLE_MENU_NOTITLE(tab, menu, lines_count) \
|
#define SIMPLE_MENU_NOTITLE(tab, menu, lines_count) \
|
||||||
check_simple(event, menu, tab, DIM(tab), (lines_count)-1);
|
check_simple(event, menu, tab, DIM(tab), (lines_count)-1);
|
||||||
|
|
||||||
|
@ -343,9 +333,9 @@ int8_t switchMenuItem(coord_t x, coord_t y, int8_t value, LcdFlags attr, uint8_t
|
||||||
|
|
||||||
void editName(coord_t x, coord_t y, char *name, uint8_t size, uint8_t event, uint8_t active);
|
void editName(coord_t x, coord_t y, char *name, uint8_t size, uint8_t event, uint8_t active);
|
||||||
|
|
||||||
#define WARNING_TYPE_ASTERISK 0
|
#define WARNING_TYPE_ASTERISK 0
|
||||||
#define WARNING_TYPE_CONFIRM 1
|
#define WARNING_TYPE_CONFIRM 1
|
||||||
#define WARNING_TYPE_INPUT 2
|
#define WARNING_TYPE_INPUT 2
|
||||||
|
|
||||||
extern const pm_char * s_warning;
|
extern const pm_char * s_warning;
|
||||||
extern const pm_char * s_warning_info;
|
extern const pm_char * s_warning_info;
|
||||||
|
@ -353,12 +343,12 @@ extern uint8_t s_warning_info_len;
|
||||||
extern uint8_t s_warning_result;
|
extern uint8_t s_warning_result;
|
||||||
extern uint8_t s_warning_type;
|
extern uint8_t s_warning_type;
|
||||||
|
|
||||||
#define MENU_X 10
|
#define MENU_X 10
|
||||||
#define MENU_Y 16
|
#define MENU_Y 16
|
||||||
#define MENU_W LCD_W-(2*MENU_X)
|
#define MENU_W LCD_W-(2*MENU_X)
|
||||||
#define WARNING_LINE_LEN 20
|
#define WARNING_LINE_LEN 20
|
||||||
#define WARNING_LINE_X 16
|
#define WARNING_LINE_X 16
|
||||||
#define WARNING_LINE_Y 3*FH
|
#define WARNING_LINE_Y 3*FH
|
||||||
|
|
||||||
void displayBox();
|
void displayBox();
|
||||||
void displayPopup(const pm_char * pstr);
|
void displayPopup(const pm_char * pstr);
|
||||||
|
@ -380,9 +370,9 @@ void displayWarning(uint8_t event);
|
||||||
#define WARNING_INFO_FLAGS 0
|
#define WARNING_INFO_FLAGS 0
|
||||||
#define SET_WARNING_INFO(...)
|
#define SET_WARNING_INFO(...)
|
||||||
#elif defined(CPUARM)
|
#elif defined(CPUARM)
|
||||||
#define DISPLAY_WARNING (*popupFunc)
|
#define DISPLAY_WARNING (*popupFunc)
|
||||||
#define POPUP_WARNING(s) (s_warning = s, s_warning_info = 0, popupFunc = displayWarning)
|
#define POPUP_WARNING(s) (s_warning = s, s_warning_info = 0, popupFunc = displayWarning)
|
||||||
#define POPUP_CONFIRMATION(s) (s_warning = s, s_warning_type = WARNING_TYPE_CONFIRM, s_warning_info = 0, popupFunc = displayWarning)
|
#define POPUP_CONFIRMATION(s) (s_warning = s, s_warning_type = WARNING_TYPE_CONFIRM, s_warning_info = 0, popupFunc = displayWarning)
|
||||||
#define POPUP_INPUT(s, func, start, min, max) (s_warning = s, s_warning_type = WARNING_TYPE_INPUT, popupFunc = func, s_warning_input_value = start, s_warning_input_min = min, s_warning_input_max = max)
|
#define POPUP_INPUT(s, func, start, min, max) (s_warning = s, s_warning_type = WARNING_TYPE_INPUT, popupFunc = func, s_warning_input_value = start, s_warning_input_min = min, s_warning_input_max = max)
|
||||||
#define WARNING_INFO_FLAGS s_warning_info_flags
|
#define WARNING_INFO_FLAGS s_warning_info_flags
|
||||||
#define SET_WARNING_INFO(info, len, flags) (s_warning_info = info, s_warning_info_len = len, s_warning_info_flags = flags)
|
#define SET_WARNING_INFO(info, len, flags) (s_warning_info = info, s_warning_info_len = len, s_warning_info_flags = flags)
|
||||||
|
@ -454,7 +444,6 @@ void displayWarning(uint8_t event);
|
||||||
#define MOVE_CURSOR_FROM_HERE() REPEAT_LAST_CURSOR_MOVE()
|
#define MOVE_CURSOR_FROM_HERE() REPEAT_LAST_CURSOR_MOVE()
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define POS_VERT_INIT 0
|
|
||||||
#define POS_HORZ_INIT(posVert) 0
|
#define POS_HORZ_INIT(posVert) 0
|
||||||
#define EDIT_MODE_INIT -1
|
#define EDIT_MODE_INIT -1
|
||||||
|
|
||||||
|
|
|
@ -474,7 +474,7 @@ void check(check_event_t event, uint8_t curr, const MenuFuncP *menuTab, uint8_t
|
||||||
#if defined(CPUARM)
|
#if defined(CPUARM)
|
||||||
menuEntryTime = get_tmr10ms();
|
menuEntryTime = get_tmr10ms();
|
||||||
#endif
|
#endif
|
||||||
l_posVert = POS_VERT_INIT;
|
l_posVert = 0;
|
||||||
l_posHorz = POS_HORZ_INIT(l_posVert);
|
l_posHorz = POS_HORZ_INIT(l_posVert);
|
||||||
SET_SCROLLBAR_X(LCD_W-1);
|
SET_SCROLLBAR_X(LCD_W-1);
|
||||||
#if defined(ROTARY_ENCODER_NAVIGATION)
|
#if defined(ROTARY_ENCODER_NAVIGATION)
|
||||||
|
@ -510,8 +510,8 @@ void check(check_event_t event, uint8_t curr, const MenuFuncP *menuTab, uint8_t
|
||||||
case EVT_ROTARY_LONG:
|
case EVT_ROTARY_LONG:
|
||||||
if (s_editMode > 1) break;
|
if (s_editMode > 1) break;
|
||||||
killEvents(event);
|
killEvents(event);
|
||||||
if (l_posVert != POS_VERT_INIT) {
|
if (l_posVert != 0) {
|
||||||
l_posVert = POS_VERT_INIT;
|
l_posVert = 0;
|
||||||
s_editMode = EDIT_MODE_INIT;
|
s_editMode = EDIT_MODE_INIT;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -574,7 +574,7 @@ void check(check_event_t event, uint8_t curr, const MenuFuncP *menuTab, uint8_t
|
||||||
case EVT_KEY_FIRST(KEY_DOWN): //inc
|
case EVT_KEY_FIRST(KEY_DOWN): //inc
|
||||||
if (s_editMode>0) break;
|
if (s_editMode>0) break;
|
||||||
do {
|
do {
|
||||||
INC(l_posVert, POS_VERT_INIT, maxrow);
|
INC(l_posVert, 0, maxrow);
|
||||||
} while (CURSOR_NOT_ALLOWED_IN_ROW(l_posVert));
|
} while (CURSOR_NOT_ALLOWED_IN_ROW(l_posVert));
|
||||||
|
|
||||||
#if defined(ROTARY_ENCODER_NAVIGATION)
|
#if defined(ROTARY_ENCODER_NAVIGATION)
|
||||||
|
@ -617,7 +617,7 @@ void check(check_event_t event, uint8_t curr, const MenuFuncP *menuTab, uint8_t
|
||||||
if (s_editMode>0) break;
|
if (s_editMode>0) break;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
DEC(l_posVert, POS_VERT_INIT, maxrow);
|
DEC(l_posVert, 0, maxrow);
|
||||||
} while (CURSOR_NOT_ALLOWED_IN_ROW(l_posVert));
|
} while (CURSOR_NOT_ALLOWED_IN_ROW(l_posVert));
|
||||||
|
|
||||||
#if defined(ROTARY_ENCODER_NAVIGATION)
|
#if defined(ROTARY_ENCODER_NAVIGATION)
|
||||||
|
|
|
@ -71,7 +71,7 @@ void displayPopup(const pm_char * pstr)
|
||||||
|
|
||||||
void message(const pm_char *title, const pm_char *t, const char *last MESSAGE_SOUND_ARG)
|
void message(const pm_char *title, const pm_char *t, const char *last MESSAGE_SOUND_ARG)
|
||||||
{
|
{
|
||||||
lcd_clear();
|
lcdClear();
|
||||||
lcd_img(2, 0, asterisk_lbm, 0, 0);
|
lcd_img(2, 0, asterisk_lbm, 0, 0);
|
||||||
|
|
||||||
#define MESSAGE_LCD_OFFSET 6*FW
|
#define MESSAGE_LCD_OFFSET 6*FW
|
||||||
|
|
|
@ -45,7 +45,7 @@ const pm_uchar * const splash_lbm = splashdata+4;
|
||||||
|
|
||||||
void displaySplash()
|
void displaySplash()
|
||||||
{
|
{
|
||||||
lcd_clear();
|
lcdClear();
|
||||||
lcd_img(0, 0, splash_lbm, 0, 0);
|
lcd_img(0, 0, splash_lbm, 0, 0);
|
||||||
|
|
||||||
#if MENUS_LOCK == 1
|
#if MENUS_LOCK == 1
|
||||||
|
|
|
@ -64,10 +64,18 @@ const uint8_t LBM_CURRENT_DOT[] = {
|
||||||
* Main view bitmaps
|
* Main view bitmaps
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
const uint16_t LBM_MAINVIEW_BACKGROUND[] = {
|
||||||
|
#include "../../bitmaps/Horus/background.lbm"
|
||||||
|
};
|
||||||
|
|
||||||
const uint8_t LBM_TOPMENU_OPENTX[] = {
|
const uint8_t LBM_TOPMENU_OPENTX[] = {
|
||||||
#include "../../bitmaps/Horus/mask_topmenu_opentx.lbm"
|
#include "../../bitmaps/Horus/mask_topmenu_opentx.lbm"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const uint8_t LBM_TOPMENU_USB[] = {
|
||||||
|
#include "../../bitmaps/Horus/mask_topmenu_usb.lbm"
|
||||||
|
};
|
||||||
|
|
||||||
const uint8_t LBM_HTRIM_FRAME[] = {
|
const uint8_t LBM_HTRIM_FRAME[] = {
|
||||||
#include "../../bitmaps/Horus/mask_htrim_frame.lbm"
|
#include "../../bitmaps/Horus/mask_htrim_frame.lbm"
|
||||||
};
|
};
|
||||||
|
@ -80,6 +88,14 @@ const uint8_t LBM_TRIM_SHADOW[] = {
|
||||||
#include "../../bitmaps/Horus/mask_trim_shadow.lbm"
|
#include "../../bitmaps/Horus/mask_trim_shadow.lbm"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const uint8_t LBM_TIMER_BACKGROUND[] = {
|
||||||
|
#include "../../bitmaps/Horus/mask_timer_bg.lbm"
|
||||||
|
};
|
||||||
|
|
||||||
|
const uint8_t LBM_RSCALE[] = {
|
||||||
|
#include "../../bitmaps/Horus/mask_rscale.lbm"
|
||||||
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Radio menu bitmaps
|
* Radio menu bitmaps
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -64,6 +64,7 @@
|
||||||
#define CURVE_CENTER_Y 159
|
#define CURVE_CENTER_Y 159
|
||||||
|
|
||||||
#define MENU_TITLE_NEXT_POS (lcdNextPos + 10)
|
#define MENU_TITLE_NEXT_POS (lcdNextPos + 10)
|
||||||
|
#define MENU_INIT_VPOS -1
|
||||||
|
|
||||||
void displaySplash();
|
void displaySplash();
|
||||||
void displayScreenIndex(uint8_t index, uint8_t count);
|
void displayScreenIndex(uint8_t index, uint8_t count);
|
||||||
|
@ -82,12 +83,16 @@ extern const uint8_t LBM_CURRENT_SHADOW[];
|
||||||
extern const uint8_t LBM_CURRENT_DOT[];
|
extern const uint8_t LBM_CURRENT_DOT[];
|
||||||
|
|
||||||
// Main view icons
|
// Main view icons
|
||||||
|
extern const uint16_t LBM_MAINVIEW_BACKGROUND[];
|
||||||
extern const uint8_t LBM_TOPMENU_OPENTX[];
|
extern const uint8_t LBM_TOPMENU_OPENTX[];
|
||||||
|
extern const uint8_t LBM_TOPMENU_USB[];
|
||||||
extern const uint8_t LBM_HTRIM_FRAME[];
|
extern const uint8_t LBM_HTRIM_FRAME[];
|
||||||
extern const uint8_t LBM_VTRIM_FRAME[];
|
extern const uint8_t LBM_VTRIM_FRAME[];
|
||||||
extern const uint8_t LBM_TRIM_SHADOW[];
|
extern const uint8_t LBM_TRIM_SHADOW[];
|
||||||
extern const uint8_t LBM_RADIO_ICON[];
|
extern const uint8_t LBM_RADIO_ICON[];
|
||||||
extern const uint8_t LBM_MODEL_ICON[];
|
extern const uint8_t LBM_MODEL_ICON[];
|
||||||
|
extern const uint8_t LBM_TIMER_BACKGROUND[];
|
||||||
|
extern const uint8_t LBM_RSCALE[];
|
||||||
|
|
||||||
// Menu icons
|
// Menu icons
|
||||||
extern const uint8_t * const LBM_RADIO_ICONS[];
|
extern const uint8_t * const LBM_RADIO_ICONS[];
|
||||||
|
|
|
@ -54,6 +54,7 @@ void lcdColorsInit()
|
||||||
lcdColorTable[SCROLLBOX_COLOR_INDEX] = RED;
|
lcdColorTable[SCROLLBOX_COLOR_INDEX] = RED;
|
||||||
lcdColorTable[MENU_TITLE_BGCOLOR_INDEX] = DARKGREY;
|
lcdColorTable[MENU_TITLE_BGCOLOR_INDEX] = DARKGREY;
|
||||||
lcdColorTable[MENU_TITLE_COLOR_INDEX] = WHITE;
|
lcdColorTable[MENU_TITLE_COLOR_INDEX] = WHITE;
|
||||||
|
lcdColorTable[MENU_TITLE_DISABLE_COLOR_INDEX] = RGB(130, 1, 5);
|
||||||
lcdColorTable[HEADER_COLOR_INDEX] = DARKGREY;
|
lcdColorTable[HEADER_COLOR_INDEX] = DARKGREY;
|
||||||
lcdColorTable[ALARM_COLOR_INDEX] = RED;
|
lcdColorTable[ALARM_COLOR_INDEX] = RED;
|
||||||
lcdColorTable[WARNING_COLOR_INDEX] = YELLOW;
|
lcdColorTable[WARNING_COLOR_INDEX] = YELLOW;
|
||||||
|
@ -790,18 +791,18 @@ void lcdSetContrast()
|
||||||
lcdSetRefVolt(g_eeGeneral.contrast);
|
lcdSetRefVolt(g_eeGeneral.contrast);
|
||||||
}
|
}
|
||||||
|
|
||||||
void lcdDrawPixel(display_t * p, display_t value)
|
inline void lcdDrawPixel(display_t * p, display_t value)
|
||||||
{
|
{
|
||||||
*p = value;
|
*p = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
void lcdDrawPixel(coord_t x, coord_t y, display_t value)
|
inline void lcdDrawPixel(coord_t x, coord_t y, display_t value)
|
||||||
{
|
{
|
||||||
display_t * p = PIXEL_PTR(x, y);
|
display_t * p = PIXEL_PTR(x, y);
|
||||||
lcdDrawPixel(p, value);
|
lcdDrawPixel(p, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
void lcdDrawTransparentPixel(coord_t x, coord_t y, uint8_t opacity, uint16_t color)
|
inline void lcdDrawTransparentPixel(coord_t x, coord_t y, uint8_t opacity, uint16_t color)
|
||||||
{
|
{
|
||||||
display_t * p = PIXEL_PTR(x, y);
|
display_t * p = PIXEL_PTR(x, y);
|
||||||
lcdDrawTransparentPixel(p, opacity, color);
|
lcdDrawTransparentPixel(p, opacity, color);
|
||||||
|
@ -938,56 +939,66 @@ void lcdDrawCircle(int x0, int y0, int radius)
|
||||||
|
|
||||||
#define PI 3.14159265
|
#define PI 3.14159265
|
||||||
|
|
||||||
void lcdDrawPie(int x0, int y0, int radius, int startAngle, int endAngle)
|
bool evalSlopes(int * slopes, int startAngle, int endAngle)
|
||||||
{
|
{
|
||||||
int slope1s, slope1e, slope2s, slope2e;
|
|
||||||
|
|
||||||
if (startAngle >= 360 || endAngle <= 0)
|
if (startAngle >= 360 || endAngle <= 0)
|
||||||
return;
|
return false;
|
||||||
|
|
||||||
float angle1 = float(startAngle) * PI / 180;
|
|
||||||
float angle2 = float(endAngle) * PI / 180;
|
|
||||||
|
|
||||||
if (startAngle == 0) {
|
if (startAngle == 0) {
|
||||||
slope1e = 100000;
|
slopes[1] = 100000;
|
||||||
slope2s = -100000;
|
slopes[2] = -100000;
|
||||||
}
|
|
||||||
else if (startAngle >= 180) {
|
|
||||||
slope1e = -100000;
|
|
||||||
slope2s = cos(angle1)*100/sin(angle1);
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
slope1e = cos(angle1)*100/sin(angle1);
|
float angle1 = float(startAngle) * PI / 180;
|
||||||
slope2s = -100000;
|
if (startAngle >= 180) {
|
||||||
|
slopes[1] = -100000;
|
||||||
|
slopes[2] = cos(angle1) * 100 / sin(angle1);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
slopes[1] = cos(angle1) * 100 / sin(angle1);
|
||||||
|
slopes[2] = -100000;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (endAngle == 360) {
|
if (endAngle == 360) {
|
||||||
slope1s = -100000;
|
slopes[0] = -100000;
|
||||||
slope2e = 100000;
|
slopes[3] = 100000;
|
||||||
}
|
|
||||||
else if (endAngle >= 180) {
|
|
||||||
slope1s = -100000;
|
|
||||||
slope2e = -cos(angle2)*100/sin(angle2);
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
slope1s = cos(angle2)*100/sin(angle2);
|
float angle2 = float(endAngle) * PI / 180;
|
||||||
slope2e = -100000;
|
if (endAngle >= 180) {
|
||||||
|
slopes[0] = -100000;
|
||||||
|
slopes[3] = -cos(angle2) * 100 / sin(angle2);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
slopes[0] = cos(angle2) * 100 / sin(angle2);
|
||||||
|
slopes[3] = -100000;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void lcdDrawPie(int x0, int y0, int radius, int startAngle, int endAngle)
|
||||||
|
{
|
||||||
|
int slopes[4];
|
||||||
|
if (!evalSlopes(slopes, startAngle, endAngle))
|
||||||
|
return;
|
||||||
|
|
||||||
for (int y=0; y<=radius; y++) {
|
for (int y=0; y<=radius; y++) {
|
||||||
for (int x=0; x<=radius; x++) {
|
for (int x=0; x<=radius; x++) {
|
||||||
if (x*x+y*y <= radius*radius) {
|
if (x*x+y*y <= radius*radius) {
|
||||||
int slope = (x==0 ? (y<0 ? -99000 : 99000) : y*100/x);
|
int slope = (x==0 ? (y<0 ? -99000 : 99000) : y*100/x);
|
||||||
if (slope >= slope1s && slope < slope1e) {
|
if (slope >= slopes[0] && slope < slopes[1]) {
|
||||||
lcdDrawPixel(x0+x, y0-y, WHITE);
|
lcdDrawPixel(x0+x, y0-y, WHITE);
|
||||||
}
|
}
|
||||||
if (-slope >= slope1s && -slope < slope1e) {
|
if (-slope >= slopes[0] && -slope < slopes[1]) {
|
||||||
lcdDrawPixel(x0+x, y0+y, WHITE);
|
lcdDrawPixel(x0+x, y0+y, WHITE);
|
||||||
}
|
}
|
||||||
if (slope >= slope2s && slope < slope2e) {
|
if (slope >= slopes[2] && slope < slopes[3]) {
|
||||||
lcdDrawPixel(x0-x, y0-y, WHITE);
|
lcdDrawPixel(x0-x, y0-y, WHITE);
|
||||||
}
|
}
|
||||||
if (-slope >= slope2s && -slope < slope2e) {
|
if (-slope >= slopes[2] && -slope < slopes[3]) {
|
||||||
lcdDrawPixel(x0-x, y0+y, WHITE);
|
lcdDrawPixel(x0-x, y0+y, WHITE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1001,56 +1012,26 @@ void lcdDrawBitmapPie(int x0, int y0, const uint16_t * img, int startAngle, int
|
||||||
coord_t width = *q++;
|
coord_t width = *q++;
|
||||||
coord_t height = *q++;
|
coord_t height = *q++;
|
||||||
|
|
||||||
int slope1s, slope1e, slope2s, slope2e;
|
int slopes[4];
|
||||||
|
if (!evalSlopes(slopes, startAngle, endAngle))
|
||||||
if (startAngle >= 360 || endAngle <= 0)
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
float angle1 = float(startAngle) * PI / 180;
|
|
||||||
float angle2 = float(endAngle) * PI / 180;
|
|
||||||
|
|
||||||
if (startAngle == 0) {
|
|
||||||
slope1e = 100000;
|
|
||||||
slope2s = -100000;
|
|
||||||
}
|
|
||||||
else if (startAngle >= 180) {
|
|
||||||
slope1e = -100000;
|
|
||||||
slope2s = cos(angle1)*100/sin(angle1);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
slope1e = cos(angle1)*100/sin(angle1);
|
|
||||||
slope2s = -100000;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (endAngle == 360) {
|
|
||||||
slope1s = -100000;
|
|
||||||
slope2e = 100000;
|
|
||||||
}
|
|
||||||
else if (endAngle >= 180) {
|
|
||||||
slope1s = -100000;
|
|
||||||
slope2e = -cos(angle2)*100/sin(angle2);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
slope1s = cos(angle2)*100/sin(angle2);
|
|
||||||
slope2e = -100000;
|
|
||||||
}
|
|
||||||
|
|
||||||
int w2 = width/2;
|
int w2 = width/2;
|
||||||
int h2 = height/2;
|
int h2 = height/2;
|
||||||
|
|
||||||
for (int y=h2-1; y>=0; y--) {
|
for (int y=h2-1; y>=0; y--) {
|
||||||
for (int x=w2-1; x>=0; x--) {
|
for (int x=w2-1; x>=0; x--) {
|
||||||
int slope = (x==0 ? (y<0 ? -99000 : 99000) : y*100/x);
|
int slope = (x==0 ? (y<0 ? -99000 : 99000) : y*100/x);
|
||||||
if (slope >= slope1s && slope < slope1e) {
|
if (slope >= slopes[0] && slope < slopes[1]) {
|
||||||
displayBuf[(y0+h2-y)*LCD_W + x0+w2+x] = q[(h2-y)*width + w2+x];
|
displayBuf[(y0+h2-y)*LCD_W + x0+w2+x] = q[(h2-y)*width + w2+x];
|
||||||
}
|
}
|
||||||
if (-slope >= slope1s && -slope < slope1e) {
|
if (-slope >= slopes[0] && -slope < slopes[1]) {
|
||||||
displayBuf[(y0+h2+y)*LCD_W + x0+w2+x] = q[(h2+y)*width + w2+x];
|
displayBuf[(y0+h2+y)*LCD_W + x0+w2+x] = q[(h2+y)*width + w2+x];
|
||||||
}
|
}
|
||||||
if (slope >= slope2s && slope < slope2e) {
|
if (slope >= slopes[2] && slope < slopes[3]) {
|
||||||
displayBuf[(y0+h2-y)*LCD_W + x0+w2-x] = q[(h2-y)*width + w2-x];
|
displayBuf[(y0+h2-y)*LCD_W + x0+w2-x] = q[(h2-y)*width + w2-x];
|
||||||
}
|
}
|
||||||
if (-slope >= slope2s && -slope < slope2e) {
|
if (-slope >= slopes[2] && -slope < slopes[3]) {
|
||||||
displayBuf[(y0+h2+y)*LCD_W + x0+w2-x] = q[(h2+y)*width + w2-x];
|
displayBuf[(y0+h2+y)*LCD_W + x0+w2-x] = q[(h2+y)*width + w2-x];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1063,58 +1044,28 @@ void lcdDrawBitmapPatternPie(coord_t x0, coord_t y0, const uint8_t * img, LcdFla
|
||||||
coord_t height = *(((uint16_t *)img)+1);
|
coord_t height = *(((uint16_t *)img)+1);
|
||||||
const uint8_t * q = img+4;
|
const uint8_t * q = img+4;
|
||||||
|
|
||||||
int slope1s, slope1e, slope2s, slope2e;
|
int slopes[4];
|
||||||
|
if (!evalSlopes(slopes, startAngle, endAngle))
|
||||||
if (startAngle >= 360 || endAngle <= 0)
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
display_t color = lcdColorTable[COLOR_IDX(flags)];
|
display_t color = lcdColorTable[COLOR_IDX(flags)];
|
||||||
|
|
||||||
float angle1 = float(startAngle) * PI / 180;
|
|
||||||
float angle2 = float(endAngle) * PI / 180;
|
|
||||||
|
|
||||||
if (startAngle == 0) {
|
|
||||||
slope1e = 100000;
|
|
||||||
slope2s = -100000;
|
|
||||||
}
|
|
||||||
else if (startAngle >= 180) {
|
|
||||||
slope1e = -100000;
|
|
||||||
slope2s = cos(angle1)*100/sin(angle1);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
slope1e = cos(angle1)*100/sin(angle1);
|
|
||||||
slope2s = -100000;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (endAngle == 360) {
|
|
||||||
slope1s = -100000;
|
|
||||||
slope2e = 100000;
|
|
||||||
}
|
|
||||||
else if (endAngle >= 180) {
|
|
||||||
slope1s = -100000;
|
|
||||||
slope2e = -cos(angle2)*100/sin(angle2);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
slope1s = cos(angle2)*100/sin(angle2);
|
|
||||||
slope2e = -100000;
|
|
||||||
}
|
|
||||||
|
|
||||||
int w2 = width/2;
|
int w2 = width/2;
|
||||||
int h2 = height/2;
|
int h2 = height/2;
|
||||||
|
|
||||||
for (int y=h2-1; y>=0; y--) {
|
for (int y=h2-1; y>=0; y--) {
|
||||||
for (int x=w2-1; x>=0; x--) {
|
for (int x=w2-1; x>=0; x--) {
|
||||||
int slope = (x==0 ? (y<0 ? -99000 : 99000) : y*100/x);
|
int slope = (x==0 ? (y<0 ? -99000 : 99000) : y*100/x);
|
||||||
if (slope >= slope1s && slope < slope1e) {
|
if (slope >= slopes[0] && slope < slopes[1]) {
|
||||||
lcdDrawTransparentPixel(x0+w2+x, y0+h2-y, q[(h2-y)*width + w2+x], color);
|
lcdDrawTransparentPixel(x0+w2+x, y0+h2-y, q[(h2-y)*width + w2+x], color);
|
||||||
}
|
}
|
||||||
if (-slope >= slope1s && -slope < slope1e) {
|
if (-slope >= slopes[0] && -slope < slopes[1]) {
|
||||||
lcdDrawTransparentPixel(x0+w2+x, y0+h2+y, q[(h2+y)*width + w2+x], color);
|
lcdDrawTransparentPixel(x0+w2+x, y0+h2+y, q[(h2+y)*width + w2+x], color);
|
||||||
}
|
}
|
||||||
if (slope >= slope2s && slope < slope2e) {
|
if (slope >= slopes[2] && slope < slopes[3]) {
|
||||||
lcdDrawTransparentPixel(x0+w2-x, y0+h2-y, q[(h2-y)*width + w2-x], color);
|
lcdDrawTransparentPixel(x0+w2-x, y0+h2-y, q[(h2-y)*width + w2-x], color);
|
||||||
}
|
}
|
||||||
if (-slope >= slope2s && -slope < slope2e) {
|
if (-slope >= slopes[2] && -slope < slopes[3]) {
|
||||||
lcdDrawTransparentPixel(x0+w2-x, y0+h2+y, q[(h2+y)*width + w2-x], color);
|
lcdDrawTransparentPixel(x0+w2-x, y0+h2+y, q[(h2+y)*width + w2-x], color);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -123,6 +123,7 @@ enum LcdColorIndex
|
||||||
SCROLLBOX_COLOR_INDEX,
|
SCROLLBOX_COLOR_INDEX,
|
||||||
MENU_TITLE_BGCOLOR_INDEX,
|
MENU_TITLE_BGCOLOR_INDEX,
|
||||||
MENU_TITLE_COLOR_INDEX,
|
MENU_TITLE_COLOR_INDEX,
|
||||||
|
MENU_TITLE_DISABLE_COLOR_INDEX,
|
||||||
HEADER_COLOR_INDEX,
|
HEADER_COLOR_INDEX,
|
||||||
ALARM_COLOR_INDEX,
|
ALARM_COLOR_INDEX,
|
||||||
WARNING_COLOR_INDEX,
|
WARNING_COLOR_INDEX,
|
||||||
|
@ -141,25 +142,26 @@ void lcdColorsInit();
|
||||||
#define OPACITY_MAX 0x0F
|
#define OPACITY_MAX 0x0F
|
||||||
#define OPACITY(x) ((x)<<24)
|
#define OPACITY(x) ((x)<<24)
|
||||||
|
|
||||||
#define COLOR(index) ((index) << 16)
|
#define COLOR(index) ((index) << 16)
|
||||||
#define TEXT_COLOR COLOR(TEXT_COLOR_INDEX)
|
#define TEXT_COLOR COLOR(TEXT_COLOR_INDEX)
|
||||||
#define TEXT_BGCOLOR COLOR(TEXT_BGCOLOR_INDEX)
|
#define TEXT_BGCOLOR COLOR(TEXT_BGCOLOR_INDEX)
|
||||||
#define TEXT_INVERTED_COLOR COLOR(TEXT_INVERTED_COLOR_INDEX)
|
#define TEXT_INVERTED_COLOR COLOR(TEXT_INVERTED_COLOR_INDEX)
|
||||||
#define TEXT_INVERTED_BGCOLOR COLOR(TEXT_INVERTED_BGCOLOR_INDEX)
|
#define TEXT_INVERTED_BGCOLOR COLOR(TEXT_INVERTED_BGCOLOR_INDEX)
|
||||||
#define LINE_COLOR COLOR(LINE_COLOR_INDEX)
|
#define LINE_COLOR COLOR(LINE_COLOR_INDEX)
|
||||||
#define SCROLLBOX_COLOR COLOR(SCROLLBOX_COLOR_INDEX)
|
#define SCROLLBOX_COLOR COLOR(SCROLLBOX_COLOR_INDEX)
|
||||||
#define HEADER_SEPARATOR_COLOR COLOR(HEADER_SEPARATOR_COLOR_INDEX)
|
#define HEADER_SEPARATOR_COLOR COLOR(HEADER_SEPARATOR_COLOR_INDEX)
|
||||||
#define MENU_TITLE_BGCOLOR COLOR(MENU_TITLE_BGCOLOR_INDEX)
|
#define MENU_TITLE_BGCOLOR COLOR(MENU_TITLE_BGCOLOR_INDEX)
|
||||||
#define MENU_TITLE_COLOR COLOR(MENU_TITLE_COLOR_INDEX)
|
#define MENU_TITLE_COLOR COLOR(MENU_TITLE_COLOR_INDEX)
|
||||||
#define HEADER_COLOR COLOR(HEADER_COLOR_INDEX)
|
#define MENU_TITLE_DISABLE_COLOR COLOR(MENU_TITLE_DISABLE_COLOR_INDEX)
|
||||||
#define ALARM_COLOR COLOR(ALARM_COLOR_INDEX)
|
#define HEADER_COLOR COLOR(HEADER_COLOR_INDEX)
|
||||||
#define WARNING_COLOR COLOR(WARNING_COLOR_INDEX)
|
#define ALARM_COLOR COLOR(ALARM_COLOR_INDEX)
|
||||||
#define TEXT_DISABLE_COLOR COLOR(TEXT_DISABLE_COLOR_INDEX)
|
#define WARNING_COLOR COLOR(WARNING_COLOR_INDEX)
|
||||||
#define CURVE_AXIS_COLOR COLOR(CURVE_AXIS_COLOR_INDEX)
|
#define TEXT_DISABLE_COLOR COLOR(TEXT_DISABLE_COLOR_INDEX)
|
||||||
#define CURVE_COLOR COLOR(CURVE_COLOR_INDEX)
|
#define CURVE_AXIS_COLOR COLOR(CURVE_AXIS_COLOR_INDEX)
|
||||||
#define CURVE_CURSOR_COLOR COLOR(CURVE_CURSOR_COLOR_INDEX)
|
#define CURVE_COLOR COLOR(CURVE_COLOR_INDEX)
|
||||||
#define TITLE_BGCOLOR COLOR(TITLE_BGCOLOR_INDEX)
|
#define CURVE_CURSOR_COLOR COLOR(CURVE_CURSOR_COLOR_INDEX)
|
||||||
#define HEADER_BGCOLOR COLOR(HEADER_BGCOLOR_INDEX)
|
#define TITLE_BGCOLOR COLOR(TITLE_BGCOLOR_INDEX)
|
||||||
|
#define HEADER_BGCOLOR COLOR(HEADER_BGCOLOR_INDEX)
|
||||||
|
|
||||||
#define COLOR_IDX(att) uint8_t((att) >> 16)
|
#define COLOR_IDX(att) uint8_t((att) >> 16)
|
||||||
|
|
||||||
|
|
|
@ -39,6 +39,36 @@
|
||||||
#define XPOT_DELTA 10
|
#define XPOT_DELTA 10
|
||||||
#define XPOT_DELAY 10 /* cycles */
|
#define XPOT_DELAY 10 /* cycles */
|
||||||
|
|
||||||
|
#define BAR_HEIGHT (BOX_WIDTH-9)
|
||||||
|
#define LBOX_CENTERX (BOX_WIDTH/2 + 17)
|
||||||
|
#define RBOX_CENTERX (LCD_W-LBOX_CENTERX)
|
||||||
|
|
||||||
|
void drawPotsBars()
|
||||||
|
{
|
||||||
|
// Optimization by Mike Blandford
|
||||||
|
uint8_t x, i, len ; // declare temporary variables
|
||||||
|
for (x=LCD_W/2-9, i=NUM_STICKS; i<NUM_STICKS+NUM_POTS; x+=9, i++) {
|
||||||
|
if (IS_POT_AVAILABLE(i)) {
|
||||||
|
len = ((calibratedStick[i]+RESX)*BAR_HEIGHT/(RESX*2))+1l; // calculate once per loop
|
||||||
|
// TODO 220 constant
|
||||||
|
lcdDrawSolidFilledRect(x, 220-FH-len, 5, len, TEXT_COLOR);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void drawSticksPositions()
|
||||||
|
{
|
||||||
|
int16_t calibStickVert = calibratedStick[CONVERT_MODE(1)];
|
||||||
|
if (g_model.throttleReversed && CONVERT_MODE(1) == THR_STICK)
|
||||||
|
calibStickVert = -calibStickVert;
|
||||||
|
drawStick(LBOX_CENTERX, calibratedStick[CONVERT_MODE(0)], calibStickVert);
|
||||||
|
|
||||||
|
calibStickVert = calibratedStick[CONVERT_MODE(2)];
|
||||||
|
if (g_model.throttleReversed && CONVERT_MODE(2) == THR_STICK)
|
||||||
|
calibStickVert = -calibStickVert;
|
||||||
|
drawStick(RBOX_CENTERX, calibratedStick[CONVERT_MODE(3)], calibStickVert);
|
||||||
|
}
|
||||||
|
|
||||||
void menuCommonCalib(evt_t event)
|
void menuCommonCalib(evt_t event)
|
||||||
{
|
{
|
||||||
for (uint8_t i=0; i<NUM_STICKS+NUM_POTS; i++) { // get low and high vals for sticks and trims
|
for (uint8_t i=0; i<NUM_STICKS+NUM_POTS; i++) { // get low and high vals for sticks and trims
|
||||||
|
@ -172,7 +202,7 @@ void menuCommonCalib(evt_t event)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
doMainScreenGraphics();
|
drawSticksPositions();
|
||||||
drawPotsBars();
|
drawPotsBars();
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
|
|
|
@ -72,7 +72,6 @@ typedef void (*MenuFuncP)(evt_t event);
|
||||||
typedef void (*MenuFuncP_PROGMEM)(evt_t event);
|
typedef void (*MenuFuncP_PROGMEM)(evt_t event);
|
||||||
extern const MenuFuncP_PROGMEM menuTabModel[];
|
extern const MenuFuncP_PROGMEM menuTabModel[];
|
||||||
extern const MenuFuncP_PROGMEM menuTabGeneral[];
|
extern const MenuFuncP_PROGMEM menuTabGeneral[];
|
||||||
extern const MenuFuncP_PROGMEM menuTabTelemetry[];
|
|
||||||
|
|
||||||
extern MenuFuncP g_menuStack[5];
|
extern MenuFuncP g_menuStack[5];
|
||||||
extern uint8_t g_menuPos[4];
|
extern uint8_t g_menuPos[4];
|
||||||
|
@ -85,14 +84,7 @@ void chainMenu(MenuFuncP newMenu);
|
||||||
void pushMenu(MenuFuncP newMenu);
|
void pushMenu(MenuFuncP newMenu);
|
||||||
/// return to last menu in menustack
|
/// return to last menu in menustack
|
||||||
void popMenu();
|
void popMenu();
|
||||||
///deliver address of last menu which was popped from
|
|
||||||
inline MenuFuncP lastPopMenu()
|
|
||||||
{
|
|
||||||
return g_menuStack[g_menuStackPtr+1];
|
|
||||||
}
|
|
||||||
|
|
||||||
void drawPotsBars();
|
|
||||||
void doMainScreenGraphics();
|
|
||||||
void menuFirstCalib(evt_t event);
|
void menuFirstCalib(evt_t event);
|
||||||
|
|
||||||
void onMainViewMenu(const char *result);
|
void onMainViewMenu(const char *result);
|
||||||
|
@ -141,7 +133,6 @@ extern int8_t s_editMode; // global editmode
|
||||||
#define TITLE_ROW ((uint8_t)-1)
|
#define TITLE_ROW ((uint8_t)-1)
|
||||||
#define HIDDEN_ROW ((uint8_t)-2)
|
#define HIDDEN_ROW ((uint8_t)-2)
|
||||||
|
|
||||||
typedef bool (*IsValueAvailable)(int);
|
|
||||||
struct CheckIncDecStops {
|
struct CheckIncDecStops {
|
||||||
const int count;
|
const int count;
|
||||||
const int stops[];
|
const int stops[];
|
||||||
|
@ -345,9 +336,9 @@ void menuChannelsView(evt_t event);
|
||||||
#define REPEAT_LAST_CURSOR_MOVE() { if (CURSOR_MOVED_LEFT(event) || CURSOR_MOVED_RIGHT(event)) putEvent(event); else m_posHorz = 0; }
|
#define REPEAT_LAST_CURSOR_MOVE() { if (CURSOR_MOVED_LEFT(event) || CURSOR_MOVED_RIGHT(event)) putEvent(event); else m_posHorz = 0; }
|
||||||
#define MOVE_CURSOR_FROM_HERE() if (m_posHorz > 0) REPEAT_LAST_CURSOR_MOVE()
|
#define MOVE_CURSOR_FROM_HERE() if (m_posHorz > 0) REPEAT_LAST_CURSOR_MOVE()
|
||||||
|
|
||||||
#define POS_VERT_INIT (MAXCOL((uint16_t)0) >= HIDDEN_ROW ? (MAXCOL((uint16_t)1) >= HIDDEN_ROW ? 2 : 1) : 0)
|
#define MENU_FIRST_LINE_EDIT (MAXCOL((uint16_t)0) >= HIDDEN_ROW ? (MAXCOL((uint16_t)1) >= HIDDEN_ROW ? 2 : 1) : 0)
|
||||||
#define POS_HORZ_INIT(posVert) ((COLATTR(posVert) & NAVIGATION_LINE_BY_LINE) ? -1 : 0)
|
#define POS_HORZ_INIT(posVert) ((COLATTR(posVert) & NAVIGATION_LINE_BY_LINE) ? -1 : 0)
|
||||||
#define EDIT_MODE_INIT 0 // TODO enum
|
#define EDIT_MODE_INIT 0 // TODO enum
|
||||||
|
|
||||||
typedef int (*FnFuncP) (int x);
|
typedef int (*FnFuncP) (int x);
|
||||||
void DrawFunction(FnFuncP fn, int offset=0);
|
void DrawFunction(FnFuncP fn, int offset=0);
|
||||||
|
|
|
@ -243,7 +243,7 @@ bool check(check_event_t event, uint8_t curr, const MenuFuncP *menuTab, uint8_t
|
||||||
|
|
||||||
case EVT_KEY_BREAK(KEY_ENTER):
|
case EVT_KEY_BREAK(KEY_ENTER):
|
||||||
if (rowcount > 0) {
|
if (rowcount > 0) {
|
||||||
l_posVert = POS_VERT_INIT;
|
l_posVert = MENU_FIRST_LINE_EDIT;
|
||||||
event = 0;
|
event = 0;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -347,7 +347,7 @@ bool check(check_event_t event, uint8_t curr, const MenuFuncP *menuTab, uint8_t
|
||||||
case EVT_KEY_FIRST(KEY_DOWN):
|
case EVT_KEY_FIRST(KEY_DOWN):
|
||||||
case EVT_KEY_REPT(KEY_DOWN):
|
case EVT_KEY_REPT(KEY_DOWN):
|
||||||
do {
|
do {
|
||||||
INC(l_posVert, POS_VERT_INIT, rowcount-1);
|
INC(l_posVert, MENU_FIRST_LINE_EDIT, rowcount-1);
|
||||||
} while (CURSOR_NOT_ALLOWED_IN_ROW(l_posVert));
|
} while (CURSOR_NOT_ALLOWED_IN_ROW(l_posVert));
|
||||||
s_editMode = 0; // if we go down, we must be in this mode
|
s_editMode = 0; // if we go down, we must be in this mode
|
||||||
l_posHorz = POS_HORZ_INIT(l_posVert);
|
l_posHorz = POS_HORZ_INIT(l_posVert);
|
||||||
|
@ -376,7 +376,7 @@ bool check(check_event_t event, uint8_t curr, const MenuFuncP *menuTab, uint8_t
|
||||||
case EVT_KEY_FIRST(KEY_UP):
|
case EVT_KEY_FIRST(KEY_UP):
|
||||||
case EVT_KEY_REPT(KEY_UP):
|
case EVT_KEY_REPT(KEY_UP):
|
||||||
do {
|
do {
|
||||||
DEC(l_posVert, POS_VERT_INIT, rowcount-1);
|
DEC(l_posVert, MENU_FIRST_LINE_EDIT, rowcount-1);
|
||||||
} while (CURSOR_NOT_ALLOWED_IN_ROW(l_posVert));
|
} while (CURSOR_NOT_ALLOWED_IN_ROW(l_posVert));
|
||||||
|
|
||||||
s_editMode = 0; // if we go up, we must be in this mode
|
s_editMode = 0; // if we go up, we must be in this mode
|
||||||
|
|
|
@ -36,13 +36,6 @@
|
||||||
|
|
||||||
#include "../../opentx.h"
|
#include "../../opentx.h"
|
||||||
|
|
||||||
#define BIGSIZE MIDSIZE
|
|
||||||
#define BAR_HEIGHT (BOX_WIDTH-9)
|
|
||||||
#define LBOX_CENTERX (BOX_WIDTH/2 + 17)
|
|
||||||
#define RBOX_CENTERX (LCD_W-LBOX_CENTERX)
|
|
||||||
#define BITMAP_X ((LCD_W-64)/2)
|
|
||||||
#define BITMAP_Y (LCD_H/2)
|
|
||||||
|
|
||||||
#define TRIM_LH_X 90
|
#define TRIM_LH_X 90
|
||||||
#define TRIM_LV_X 24
|
#define TRIM_LV_X 24
|
||||||
#define TRIM_RV_X (LCD_W-35)
|
#define TRIM_RV_X (LCD_W-35)
|
||||||
|
@ -51,32 +44,6 @@
|
||||||
#define TRIM_H_Y 235
|
#define TRIM_H_Y 235
|
||||||
#define TRIM_LEN 80
|
#define TRIM_LEN 80
|
||||||
|
|
||||||
void drawPotsBars()
|
|
||||||
{
|
|
||||||
// Optimization by Mike Blandford
|
|
||||||
uint8_t x, i, len ; // declare temporary variables
|
|
||||||
for (x=LCD_W/2-9, i=NUM_STICKS; i<NUM_STICKS+NUM_POTS; x+=9, i++) {
|
|
||||||
if (IS_POT_AVAILABLE(i)) {
|
|
||||||
len = ((calibratedStick[i]+RESX)*BAR_HEIGHT/(RESX*2))+1l; // calculate once per loop
|
|
||||||
// TODO 220 constant
|
|
||||||
lcdDrawSolidFilledRect(x, 220-FH-len, 5, len, TEXT_COLOR);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void doMainScreenGraphics()
|
|
||||||
{
|
|
||||||
int16_t calibStickVert = calibratedStick[CONVERT_MODE(1)];
|
|
||||||
if (g_model.throttleReversed && CONVERT_MODE(1) == THR_STICK)
|
|
||||||
calibStickVert = -calibStickVert;
|
|
||||||
drawStick(LBOX_CENTERX, calibratedStick[CONVERT_MODE(0)], calibStickVert);
|
|
||||||
|
|
||||||
calibStickVert = calibratedStick[CONVERT_MODE(2)];
|
|
||||||
if (g_model.throttleReversed && CONVERT_MODE(2) == THR_STICK)
|
|
||||||
calibStickVert = -calibStickVert;
|
|
||||||
drawStick(RBOX_CENTERX, calibratedStick[CONVERT_MODE(3)], calibStickVert);
|
|
||||||
}
|
|
||||||
|
|
||||||
void drawTrimSquare(coord_t x, coord_t y)
|
void drawTrimSquare(coord_t x, coord_t y)
|
||||||
{
|
{
|
||||||
lcdDrawSolidFilledRect(x-2, y, 15, 15, TITLE_BGCOLOR);
|
lcdDrawSolidFilledRect(x-2, y, 15, 15, TITLE_BGCOLOR);
|
||||||
|
@ -141,7 +108,7 @@ void drawSticks()
|
||||||
drawHorizontalStick(TRIM_RH_X-TRIM_LEN+1, calibratedStick[3]);
|
drawHorizontalStick(TRIM_RH_X-TRIM_LEN+1, calibratedStick[3]);
|
||||||
}
|
}
|
||||||
|
|
||||||
void displayTrims(uint8_t flightMode)
|
void drawTrims(uint8_t flightMode)
|
||||||
{
|
{
|
||||||
g_model.displayTrims = DISPLAY_TRIMS_ALWAYS;
|
g_model.displayTrims = DISPLAY_TRIMS_ALWAYS;
|
||||||
|
|
||||||
|
@ -191,33 +158,22 @@ void displayTrims(uint8_t flightMode)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void displayTimers()
|
void drawTimer(coord_t x, coord_t y, int index)
|
||||||
{
|
{
|
||||||
// const int TIMERS_W = 56;
|
TimerData & timerData = g_model.timers[index];
|
||||||
const int TIMERS_H = 30;
|
TimerState & timerState = timersStates[index];
|
||||||
const int TIMERS_MARGIN = 16;
|
lcdDrawBitmapPattern(x, y, LBM_TIMER_BACKGROUND, TEXT_BGCOLOR);
|
||||||
const int TIMERS_PADDING = 4;
|
if (timerData.start) {
|
||||||
|
lcdDrawBitmapPatternPie(x+2, y+3, LBM_RSCALE, TITLE_BGCOLOR, 0, timerState.val <= 0 ? 360 : 360*(timerData.start-timerState.val)/timerData.start);
|
||||||
for (int i=0; i<TIMERS; i++) {
|
|
||||||
if (g_model.timers[i].mode) {
|
|
||||||
TimerState & timerState = timersStates[i];
|
|
||||||
TimerData & timerData = g_model.timers[i];
|
|
||||||
int y = TIMERS_MARGIN + i*(TIMERS_H+TIMERS_MARGIN);
|
|
||||||
unsigned int len = zlen(timerData.name, LEN_TIMER_NAME);
|
|
||||||
LcdFlags color=TEXT_COLOR, bgColor=TEXT_BGCOLOR;
|
|
||||||
if (timerState.val < 0) {
|
|
||||||
color = ALARM_COLOR;
|
|
||||||
}
|
|
||||||
// TODO lcdDrawSolidFilledRect(TIMERS_MARGIN, y, TIMERS_W, TIMERS_H, SOLID, bgColor);
|
|
||||||
putsTimer(TIMERS_MARGIN+TIMERS_PADDING, y+12, abs(timerState.val), color|DBLSIZE|LEFT);
|
|
||||||
if (len > 0)
|
|
||||||
lcd_putsnAtt(TIMERS_MARGIN+TIMERS_PADDING, y+2, timerData.name, LEN_TIMER_NAME, color|ZCHAR);
|
|
||||||
else
|
|
||||||
putsTimerMode(TIMERS_MARGIN+TIMERS_PADDING, y+2, timerData.mode, color);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
putsTimer(x+74, y+31, abs(timerState.val), TEXT_COLOR|DBLSIZE|LEFT);
|
||||||
|
if (ZLEN(timerData.name) > 0) {
|
||||||
|
lcd_putsnAtt(x+74, y+20, timerData.name, LEN_TIMER_NAME, ZCHAR|SMLSIZE|TEXT_COLOR);
|
||||||
|
}
|
||||||
|
putsStrIdx(x+137, y+17, "TMR", 1, SMLSIZE|TEXT_COLOR);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void displayMainTelemetryFields()
|
void displayMainTelemetryFields()
|
||||||
{
|
{
|
||||||
const int ALTITUDE_Y = 16;
|
const int ALTITUDE_Y = 16;
|
||||||
|
@ -329,12 +285,6 @@ void onMainViewMenu(const char *result)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void displayTelemetryScreen(int index, unsigned int evt);
|
|
||||||
|
|
||||||
const uint16_t LBM_MAINVIEW_BACKGROUND[] = {
|
|
||||||
#include "../../bitmaps/Horus/background.lbm"
|
|
||||||
};
|
|
||||||
|
|
||||||
const uint16_t LBM_MAINVIEW_FLAT[] = {
|
const uint16_t LBM_MAINVIEW_FLAT[] = {
|
||||||
#include "../../bitmaps/Horus/mainview_flat.lbm"
|
#include "../../bitmaps/Horus/mainview_flat.lbm"
|
||||||
};
|
};
|
||||||
|
@ -343,13 +293,6 @@ const uint16_t LBM_CORSAIR[] = {
|
||||||
#include "../../bitmaps/Horus/corsair.lbm"
|
#include "../../bitmaps/Horus/corsair.lbm"
|
||||||
};
|
};
|
||||||
|
|
||||||
const uint8_t LBM_TIMER_BACKGROUND[] = {
|
|
||||||
#include "../../bitmaps/Horus/mask_timer_bg.lbm"
|
|
||||||
};
|
|
||||||
|
|
||||||
const uint8_t LBM_RSCALE[] = {
|
|
||||||
#include "../../bitmaps/Horus/mask_rscale.lbm"
|
|
||||||
};
|
|
||||||
|
|
||||||
void menuMainView(evt_t event)
|
void menuMainView(evt_t event)
|
||||||
{
|
{
|
||||||
|
@ -412,6 +355,16 @@ void menuMainView(evt_t event)
|
||||||
lcdDrawBitmapPattern(0, 0, LBM_TOPMENU_POLYGON, TITLE_BGCOLOR);
|
lcdDrawBitmapPattern(0, 0, LBM_TOPMENU_POLYGON, TITLE_BGCOLOR);
|
||||||
lcdDrawBitmapPattern(4, 10, LBM_TOPMENU_OPENTX, MENU_TITLE_COLOR);
|
lcdDrawBitmapPattern(4, 10, LBM_TOPMENU_OPENTX, MENU_TITLE_COLOR);
|
||||||
lcdDrawTopmenuDatetime();
|
lcdDrawTopmenuDatetime();
|
||||||
|
if (1 || usbPlugged()) {
|
||||||
|
lcdDrawBitmapPattern(378, 8, LBM_TOPMENU_USB, MENU_TITLE_COLOR);
|
||||||
|
}
|
||||||
|
const uint8_t rssiBarsValue[] = { 30, 40, 50, 60, 80 };
|
||||||
|
const uint8_t rssiBarsHeight[] = { 5, 10, 15, 21, 31 };
|
||||||
|
for (unsigned int i=0; i<DIM(rssiBarsHeight); i++) {
|
||||||
|
uint8_t height = rssiBarsHeight[i];
|
||||||
|
lcdDrawSolidFilledRect(390+i*6, 38-height, 4, height, TELEMETRY_RSSI() >= rssiBarsValue[i] ? MENU_TITLE_COLOR : MENU_TITLE_DISABLE_COLOR);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Flight Mode Name
|
// Flight Mode Name
|
||||||
int mode = mixerCurrentFlightMode;
|
int mode = mixerCurrentFlightMode;
|
||||||
|
@ -426,38 +379,20 @@ void menuMainView(evt_t event)
|
||||||
drawSticks();
|
drawSticks();
|
||||||
|
|
||||||
// Trims
|
// Trims
|
||||||
displayTrims(mode);
|
drawTrims(mode);
|
||||||
|
|
||||||
// Model panel
|
// Model panel
|
||||||
lcdDrawFilledRect(248, 58, 188, 158, SOLID, TEXT_BGCOLOR | OPACITY(5));
|
lcdDrawFilledRect(248, 58, 188, 158, SOLID, TEXT_BGCOLOR | OPACITY(5));
|
||||||
lcdDrawBitmapPattern(256, 62, LBM_MODEL_ICON, TITLE_BGCOLOR);
|
lcdDrawBitmapPattern(256, 62, LBM_MODEL_ICON, TITLE_BGCOLOR);
|
||||||
lcd_putsnAtt(293, 68, g_model.header.name, ZCHAR|SMLSIZE, LEN_MODEL_NAME);
|
lcd_putsnAtt(293, 68, g_model.header.name, LEN_MODEL_NAME, ZCHAR|SMLSIZE);
|
||||||
lcdDrawSolidHorizontalLine(287, 85, 140, TITLE_BGCOLOR);
|
lcdDrawSolidHorizontalLine(287, 85, 140, TITLE_BGCOLOR);
|
||||||
lcdDrawBitmap(256, 104, LBM_CORSAIR);
|
lcdDrawBitmap(256, 104, LBM_CORSAIR);
|
||||||
|
|
||||||
// Timer 1
|
// Timer 1
|
||||||
if (g_model.timers[0].start) {
|
if (g_model.timers[0].mode) {
|
||||||
TimerState & timerState = timersStates[0];
|
drawTimer(50, 61, 0);
|
||||||
lcdDrawBitmapPattern(58, 61, LBM_TIMER_BACKGROUND, TEXT_BGCOLOR);
|
|
||||||
lcdDrawBitmapPatternPie(60, 64, LBM_RSCALE, TITLE_BGCOLOR, 0, 360*timerState.val/g_model.timers[0].start);
|
|
||||||
putsTimer(125, 94, abs(timerState.val), TEXT_COLOR|DBLSIZE|LEFT);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
|
||||||
displayMainViewIndex();
|
|
||||||
|
|
||||||
if (g_eeGeneral.view == VIEW_TIMERS_ALTITUDE) {
|
|
||||||
displayTimers();
|
|
||||||
displayMainTelemetryFields();
|
|
||||||
}
|
|
||||||
else if (g_eeGeneral.view == VIEW_CHANNELS) {
|
|
||||||
menuChannelsView(event);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
displayTelemetryScreen(g_eeGeneral.view - VIEW_TELEM1, event);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
if (s_gvar_timer > 0) {
|
if (s_gvar_timer > 0) {
|
||||||
s_gvar_timer--;
|
s_gvar_timer--;
|
||||||
|
|
|
@ -40,6 +40,7 @@
|
||||||
#define DEFAULT_SCROLLBAR_X (LCD_W-1)
|
#define DEFAULT_SCROLLBAR_X (LCD_W-1)
|
||||||
#define NUM_BODY_LINES (LCD_LINES-1)
|
#define NUM_BODY_LINES (LCD_LINES-1)
|
||||||
#define MENU_HEADER_HEIGHT FH
|
#define MENU_HEADER_HEIGHT FH
|
||||||
|
#define MENU_INIT_VPOS 0
|
||||||
|
|
||||||
struct MenuItem {
|
struct MenuItem {
|
||||||
const char *name;
|
const char *name;
|
||||||
|
|
|
@ -50,7 +50,7 @@ inline bool lcdIsPointOutside(coord_t x, coord_t y)
|
||||||
return (x<0 || x>=LCD_W || y<0 || y>=LCD_H);
|
return (x<0 || x>=LCD_W || y<0 || y>=LCD_H);
|
||||||
}
|
}
|
||||||
|
|
||||||
void lcd_clear()
|
void lcdClear()
|
||||||
{
|
{
|
||||||
memset(displayBuf, 0, DISPLAY_BUFFER_SIZE);
|
memset(displayBuf, 0, DISPLAY_BUFFER_SIZE);
|
||||||
}
|
}
|
||||||
|
|
|
@ -227,7 +227,7 @@ void lcd_bmp(coord_t x, coord_t y, const uint8_t * img, coord_t offset=0, coord_
|
||||||
#define LCD_ICON(x, y, icon) lcd_bmp(x, y, icons, icon)
|
#define LCD_ICON(x, y, icon) lcd_bmp(x, y, icons, icon)
|
||||||
|
|
||||||
void lcdSetRefVolt(unsigned char val);
|
void lcdSetRefVolt(unsigned char val);
|
||||||
void lcd_clear();
|
void lcdClear();
|
||||||
void lcdSetContrast();
|
void lcdSetContrast();
|
||||||
|
|
||||||
#if defined(REVPLUS) && !defined(SIMU)
|
#if defined(REVPLUS) && !defined(SIMU)
|
||||||
|
|
|
@ -98,7 +98,7 @@ void flashBootloader(const char * filename)
|
||||||
uint8_t buffer[1024];
|
uint8_t buffer[1024];
|
||||||
UINT count;
|
UINT count;
|
||||||
|
|
||||||
lcd_clear();
|
lcdClear();
|
||||||
displayProgressBar(STR_WRITING);
|
displayProgressBar(STR_WRITING);
|
||||||
|
|
||||||
static uint8_t unlocked = 0;
|
static uint8_t unlocked = 0;
|
||||||
|
@ -137,7 +137,7 @@ void flashSportDevice(ModuleIndex module, const char *filename)
|
||||||
pausePulses();
|
pausePulses();
|
||||||
watchdogSetTimeout(60*60*100/*1h*/);
|
watchdogSetTimeout(60*60*100/*1h*/);
|
||||||
|
|
||||||
lcd_clear();
|
lcdClear();
|
||||||
displayProgressBar(STR_WRITING);
|
displayProgressBar(STR_WRITING);
|
||||||
|
|
||||||
sportFirmwareUpdate(module, filename);
|
sportFirmwareUpdate(module, filename);
|
||||||
|
|
|
@ -42,7 +42,7 @@ void backupEeprom()
|
||||||
uint8_t buffer[1024];
|
uint8_t buffer[1024];
|
||||||
FIL file;
|
FIL file;
|
||||||
|
|
||||||
lcd_clear();
|
lcdClear();
|
||||||
displayProgressBar(STR_WRITING);
|
displayProgressBar(STR_WRITING);
|
||||||
|
|
||||||
// reset unexpectedShutdown to prevent warning when user restores EEPROM backup
|
// reset unexpectedShutdown to prevent warning when user restores EEPROM backup
|
||||||
|
|
|
@ -381,9 +381,9 @@ void menuModelSetup(uint8_t event)
|
||||||
#if defined(REV9E)
|
#if defined(REV9E)
|
||||||
case ITEM_MODEL_TOP_LCD_TIMER:
|
case ITEM_MODEL_TOP_LCD_TIMER:
|
||||||
lcd_putsLeft(y, STR_TOPLCDTIMER);
|
lcd_putsLeft(y, STR_TOPLCDTIMER);
|
||||||
putsStrIdx(MODEL_SETUP_2ND_COLUMN, y, STR_TIMER, g_model.topLcdTimer+1, attr);
|
putsStrIdx(MODEL_SETUP_2ND_COLUMN, y, STR_TIMER, g_model.toplcdTimer+1, attr);
|
||||||
if (attr) {
|
if (attr) {
|
||||||
g_model.topLcdTimer = checkIncDec(event, g_model.topLcdTimer, 0, TIMERS-1, EE_MODEL);
|
g_model.toplcdTimer = checkIncDec(event, g_model.toplcdTimer, 0, TIMERS-1, EE_MODEL);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -37,17 +37,17 @@
|
||||||
#ifndef _MENUS_H_
|
#ifndef _MENUS_H_
|
||||||
#define _MENUS_H_
|
#define _MENUS_H_
|
||||||
|
|
||||||
#define NO_HI_LEN 25
|
#define NO_HI_LEN 25
|
||||||
|
|
||||||
#if defined(TRANSLATIONS_FR)
|
#if defined(TRANSLATIONS_FR)
|
||||||
#define MENU_COLUMNS 1
|
#define MENU_COLUMNS 1
|
||||||
#else
|
#else
|
||||||
#define MENU_COLUMNS 2
|
#define MENU_COLUMNS 2
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define MENUS_SCROLLBAR_WIDTH 2
|
#define MENUS_SCROLLBAR_WIDTH 2
|
||||||
#define MENU_COLUMN2_X (8 + LCD_W / 2)
|
#define MENU_COLUMN2_X (8 + LCD_W / 2)
|
||||||
#define lcd_putsColumnLeft(x, y, str) lcd_puts((x > (LCD_W-10*FW-MENUS_SCROLLBAR_WIDTH)) ? MENU_COLUMN2_X : 0, y, str)
|
#define lcd_putsColumnLeft(x, y, str) lcd_puts((x > (LCD_W-10*FW-MENUS_SCROLLBAR_WIDTH)) ? MENU_COLUMN2_X : 0, y, str)
|
||||||
|
|
||||||
// Menus related stuff ...
|
// Menus related stuff ...
|
||||||
typedef uint16_t vertpos_t;
|
typedef uint16_t vertpos_t;
|
||||||
|
@ -69,8 +69,6 @@ typedef void (*MenuFuncP)(uint8_t event);
|
||||||
typedef void (*MenuFuncP_PROGMEM)(uint8_t event);
|
typedef void (*MenuFuncP_PROGMEM)(uint8_t event);
|
||||||
extern const MenuFuncP_PROGMEM menuTabModel[];
|
extern const MenuFuncP_PROGMEM menuTabModel[];
|
||||||
extern const MenuFuncP_PROGMEM menuTabGeneral[];
|
extern const MenuFuncP_PROGMEM menuTabGeneral[];
|
||||||
extern const MenuFuncP_PROGMEM menuTabFPV[];
|
|
||||||
extern const MenuFuncP_PROGMEM menuTabTelemetry[];
|
|
||||||
|
|
||||||
extern MenuFuncP g_menuStack[5];
|
extern MenuFuncP g_menuStack[5];
|
||||||
extern uint8_t g_menuPos[4];
|
extern uint8_t g_menuPos[4];
|
||||||
|
@ -83,11 +81,6 @@ void chainMenu(MenuFuncP newMenu);
|
||||||
void pushMenu(MenuFuncP newMenu);
|
void pushMenu(MenuFuncP newMenu);
|
||||||
/// return to last menu in menustack
|
/// return to last menu in menustack
|
||||||
void popMenu();
|
void popMenu();
|
||||||
///deliver address of last menu which was popped from
|
|
||||||
inline MenuFuncP lastPopMenu()
|
|
||||||
{
|
|
||||||
return g_menuStack[g_menuStackPtr+1];
|
|
||||||
}
|
|
||||||
|
|
||||||
void doMainScreenGraphics();
|
void doMainScreenGraphics();
|
||||||
void menuFirstCalib(uint8_t event);
|
void menuFirstCalib(uint8_t event);
|
||||||
|
@ -122,26 +115,25 @@ void menuChannelsView(uint8_t event);
|
||||||
|
|
||||||
extern int8_t checkIncDec_Ret; // global helper vars
|
extern int8_t checkIncDec_Ret; // global helper vars
|
||||||
|
|
||||||
#define EDIT_SELECT_MENU -1
|
#define EDIT_SELECT_MENU -1
|
||||||
#define EDIT_SELECT_FIELD 0
|
#define EDIT_SELECT_FIELD 0
|
||||||
#define EDIT_MODIFY_FIELD 1
|
#define EDIT_MODIFY_FIELD 1
|
||||||
#define EDIT_MODIFY_STRING 2
|
#define EDIT_MODIFY_STRING 2
|
||||||
extern int8_t s_editMode; // global editmode
|
extern int8_t s_editMode; // global editmode
|
||||||
|
|
||||||
// checkIncDec flags
|
// checkIncDec flags
|
||||||
#define EE_GENERAL 0x01
|
#define EE_GENERAL 0x01
|
||||||
#define EE_MODEL 0x02
|
#define EE_MODEL 0x02
|
||||||
#define NO_INCDEC_MARKS 0x04
|
#define NO_INCDEC_MARKS 0x04
|
||||||
#define INCDEC_SWITCH 0x08
|
#define INCDEC_SWITCH 0x08
|
||||||
#define INCDEC_SOURCE 0x10
|
#define INCDEC_SOURCE 0x10
|
||||||
#define INCDEC_REP10 0x40
|
#define INCDEC_REP10 0x40
|
||||||
#define NO_DBLKEYS 0x80
|
#define NO_DBLKEYS 0x80
|
||||||
|
|
||||||
// mawrow special values
|
// mawrow special values
|
||||||
#define TITLE_ROW ((uint8_t)-1)
|
#define TITLE_ROW ((uint8_t)-1)
|
||||||
#define HIDDEN_ROW ((uint8_t)-2)
|
#define HIDDEN_ROW ((uint8_t)-2)
|
||||||
|
|
||||||
typedef bool (*IsValueAvailable)(int);
|
|
||||||
struct CheckIncDecStops {
|
struct CheckIncDecStops {
|
||||||
const int count;
|
const int count;
|
||||||
const int stops[];
|
const int stops[];
|
||||||
|
@ -274,9 +266,9 @@ swsrc_t switchMenuItem(coord_t x, coord_t y, swsrc_t value, LcdFlags attr, uint8
|
||||||
|
|
||||||
void editName(coord_t x, coord_t y, char *name, uint8_t size, uint8_t event, uint8_t active, uint8_t attr=ZCHAR);
|
void editName(coord_t x, coord_t y, char *name, uint8_t size, uint8_t event, uint8_t active, uint8_t attr=ZCHAR);
|
||||||
|
|
||||||
#define WARNING_TYPE_ASTERISK 0
|
#define WARNING_TYPE_ASTERISK 0
|
||||||
#define WARNING_TYPE_CONFIRM 1
|
#define WARNING_TYPE_CONFIRM 1
|
||||||
#define WARNING_TYPE_INPUT 2
|
#define WARNING_TYPE_INPUT 2
|
||||||
|
|
||||||
extern const pm_char * s_warning;
|
extern const pm_char * s_warning;
|
||||||
extern const pm_char * s_warning_info;
|
extern const pm_char * s_warning_info;
|
||||||
|
@ -284,12 +276,12 @@ extern uint8_t s_warning_info_len;
|
||||||
extern uint8_t s_warning_result;
|
extern uint8_t s_warning_result;
|
||||||
extern uint8_t s_warning_type;
|
extern uint8_t s_warning_type;
|
||||||
|
|
||||||
#define MENU_X 30
|
#define MENU_X 30
|
||||||
#define MENU_Y 16
|
#define MENU_Y 16
|
||||||
#define MENU_W LCD_W-(2*MENU_X)
|
#define MENU_W LCD_W-(2*MENU_X)
|
||||||
#define WARNING_LINE_LEN 32
|
#define WARNING_LINE_LEN 32
|
||||||
#define WARNING_LINE_X 16
|
#define WARNING_LINE_X 16
|
||||||
#define WARNING_LINE_Y 3*FH
|
#define WARNING_LINE_Y 3*FH
|
||||||
|
|
||||||
void displayBox(const char *title);
|
void displayBox(const char *title);
|
||||||
void displayPopup(const char *title);
|
void displayPopup(const char *title);
|
||||||
|
@ -301,19 +293,19 @@ extern int16_t s_warning_input_min;
|
||||||
extern int16_t s_warning_input_max;
|
extern int16_t s_warning_input_max;
|
||||||
extern uint8_t s_warning_info_flags;
|
extern uint8_t s_warning_info_flags;
|
||||||
|
|
||||||
#define DISPLAY_WARNING (*popupFunc)
|
#define DISPLAY_WARNING (*popupFunc)
|
||||||
#define POPUP_WARNING(s) (s_warning = s, s_warning_info = 0, popupFunc = displayWarning)
|
#define POPUP_WARNING(s) (s_warning = s, s_warning_info = 0, popupFunc = displayWarning)
|
||||||
#define POPUP_CONFIRMATION(s) (s_warning = s, s_warning_type = WARNING_TYPE_CONFIRM, s_warning_info = 0, popupFunc = displayWarning)
|
#define POPUP_CONFIRMATION(s) (s_warning = s, s_warning_type = WARNING_TYPE_CONFIRM, s_warning_info = 0, popupFunc = displayWarning)
|
||||||
#define POPUP_INPUT(s, func, start, min, max) (s_warning = s, s_warning_type = WARNING_TYPE_INPUT, popupFunc = func, s_warning_input_value = start, s_warning_input_min = min, s_warning_input_max = max)
|
#define POPUP_INPUT(s, func, start, min, max) (s_warning = s, s_warning_type = WARNING_TYPE_INPUT, popupFunc = func, s_warning_input_value = start, s_warning_input_min = min, s_warning_input_max = max)
|
||||||
#define WARNING_INFO_FLAGS s_warning_info_flags
|
#define WARNING_INFO_FLAGS s_warning_info_flags
|
||||||
#define SET_WARNING_INFO(info, len, flags) (s_warning_info = info, s_warning_info_len = len, s_warning_info_flags = flags)
|
#define SET_WARNING_INFO(info, len, flags) (s_warning_info = info, s_warning_info_len = len, s_warning_info_flags = flags)
|
||||||
|
|
||||||
#define NAVIGATION_MENUS
|
#define NAVIGATION_MENUS
|
||||||
#define MENU_ADD_ITEM(s) do { s_menu_offset_type = MENU_OFFSET_INTERNAL; if (s_menu_count < MENU_MAX_LINES) s_menu[s_menu_count++] = s; } while (0)
|
#define MENU_ADD_ITEM(s) do { s_menu_offset_type = MENU_OFFSET_INTERNAL; if (s_menu_count < MENU_MAX_LINES) s_menu[s_menu_count++] = s; } while (0)
|
||||||
#define MENU_MAX_LINES 12
|
#define MENU_MAX_LINES 12
|
||||||
#define MENU_MAX_DISPLAY_LINES 6
|
#define MENU_MAX_DISPLAY_LINES 6
|
||||||
#define MENU_ADD_SD_ITEM(s) MENU_ADD_ITEM(s)
|
#define MENU_ADD_SD_ITEM(s) MENU_ADD_ITEM(s)
|
||||||
#define MENU_LINE_LENGTH (LEN_MODEL_NAME+12)
|
#define MENU_LINE_LENGTH (LEN_MODEL_NAME+12)
|
||||||
extern const char *s_menu[MENU_MAX_LINES];
|
extern const char *s_menu[MENU_MAX_LINES];
|
||||||
extern uint16_t s_menu_count;
|
extern uint16_t s_menu_count;
|
||||||
extern uint8_t s_menu_flags;
|
extern uint8_t s_menu_flags;
|
||||||
|
@ -326,12 +318,12 @@ extern uint8_t s_menu_offset_type;
|
||||||
const char * displayMenu(uint8_t event);
|
const char * displayMenu(uint8_t event);
|
||||||
extern void (*menuHandler)(const char *result);
|
extern void (*menuHandler)(const char *result);
|
||||||
|
|
||||||
#define STATUS_LINE_LENGTH 32
|
#define STATUS_LINE_LENGTH 32
|
||||||
extern char statusLineMsg[STATUS_LINE_LENGTH];
|
extern char statusLineMsg[STATUS_LINE_LENGTH];
|
||||||
void showStatusLine();
|
void showStatusLine();
|
||||||
void drawStatusLine();
|
void drawStatusLine();
|
||||||
|
|
||||||
#define TEXT_FILENAME_MAXLEN 40
|
#define TEXT_FILENAME_MAXLEN 40
|
||||||
extern char s_text_file[TEXT_FILENAME_MAXLEN];
|
extern char s_text_file[TEXT_FILENAME_MAXLEN];
|
||||||
void menuTextView(uint8_t event);
|
void menuTextView(uint8_t event);
|
||||||
void pushMenuTextView(const char *filename);
|
void pushMenuTextView(const char *filename);
|
||||||
|
@ -343,31 +335,31 @@ void menuChannelsView(uint8_t event);
|
||||||
#define LABEL(...) (uint8_t)-1
|
#define LABEL(...) (uint8_t)-1
|
||||||
|
|
||||||
#if defined(REV9E) && !defined(SIMU)
|
#if defined(REV9E) && !defined(SIMU)
|
||||||
#define KEY_MOVE_UP KEY_MINUS
|
#define KEY_MOVE_UP KEY_MINUS
|
||||||
#define KEY_MOVE_DOWN KEY_PLUS
|
#define KEY_MOVE_DOWN KEY_PLUS
|
||||||
#define CURSOR_MOVED_LEFT(event) (EVT_KEY_MASK(event) == KEY_MINUS)
|
#define CURSOR_MOVED_LEFT(event) (EVT_KEY_MASK(event) == KEY_MINUS)
|
||||||
#define CURSOR_MOVED_RIGHT(event) (EVT_KEY_MASK(event) == KEY_PLUS)
|
#define CURSOR_MOVED_RIGHT(event) (EVT_KEY_MASK(event) == KEY_PLUS)
|
||||||
#define CASE_EVT_ROTARY_MOVE_RIGHT CASE_EVT_ROTARY_RIGHT
|
#define CASE_EVT_ROTARY_MOVE_RIGHT CASE_EVT_ROTARY_RIGHT
|
||||||
#define CASE_EVT_ROTARY_MOVE_LEFT CASE_EVT_ROTARY_LEFT
|
#define CASE_EVT_ROTARY_MOVE_LEFT CASE_EVT_ROTARY_LEFT
|
||||||
#define IS_ROTARY_MOVE_RIGHT IS_ROTARY_RIGHT
|
#define IS_ROTARY_MOVE_RIGHT IS_ROTARY_RIGHT
|
||||||
#define IS_ROTARY_MOVE_LEFT IS_ROTARY_LEFT
|
#define IS_ROTARY_MOVE_LEFT IS_ROTARY_LEFT
|
||||||
#else
|
#else
|
||||||
#define KEY_MOVE_UP KEY_PLUS
|
#define KEY_MOVE_UP KEY_PLUS
|
||||||
#define KEY_MOVE_DOWN KEY_MINUS
|
#define KEY_MOVE_DOWN KEY_MINUS
|
||||||
#define CURSOR_MOVED_LEFT(event) (EVT_KEY_MASK(event) == KEY_PLUS)
|
#define CURSOR_MOVED_LEFT(event) (EVT_KEY_MASK(event) == KEY_PLUS)
|
||||||
#define CURSOR_MOVED_RIGHT(event) (EVT_KEY_MASK(event) == KEY_MINUS)
|
#define CURSOR_MOVED_RIGHT(event) (EVT_KEY_MASK(event) == KEY_MINUS)
|
||||||
#define CASE_EVT_ROTARY_MOVE_RIGHT CASE_EVT_ROTARY_LEFT
|
#define CASE_EVT_ROTARY_MOVE_RIGHT CASE_EVT_ROTARY_LEFT
|
||||||
#define CASE_EVT_ROTARY_MOVE_LEFT CASE_EVT_ROTARY_RIGHT
|
#define CASE_EVT_ROTARY_MOVE_LEFT CASE_EVT_ROTARY_RIGHT
|
||||||
#define IS_ROTARY_MOVE_RIGHT IS_ROTARY_LEFT
|
#define IS_ROTARY_MOVE_RIGHT IS_ROTARY_LEFT
|
||||||
#define IS_ROTARY_MOVE_LEFT IS_ROTARY_RIGHT
|
#define IS_ROTARY_MOVE_LEFT IS_ROTARY_RIGHT
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define REPEAT_LAST_CURSOR_MOVE() { if (CURSOR_MOVED_LEFT(event) || CURSOR_MOVED_RIGHT(event)) putEvent(event); else m_posHorz = 0; }
|
#define REPEAT_LAST_CURSOR_MOVE() { if (CURSOR_MOVED_LEFT(event) || CURSOR_MOVED_RIGHT(event)) putEvent(event); else m_posHorz = 0; }
|
||||||
#define MOVE_CURSOR_FROM_HERE() if (m_posHorz > 0) REPEAT_LAST_CURSOR_MOVE()
|
#define MOVE_CURSOR_FROM_HERE() if (m_posHorz > 0) REPEAT_LAST_CURSOR_MOVE()
|
||||||
|
|
||||||
#define POS_VERT_INIT (menuTab ? (MAXCOL((uint16_t)0) >= HIDDEN_ROW ? (MAXCOL((uint16_t)1) >= HIDDEN_ROW ? 2 : 1) : 0) : 0)
|
#define MENU_FIRST_LINE_EDIT (menuTab ? (MAXCOL((uint16_t)0) >= HIDDEN_ROW ? (MAXCOL((uint16_t)1) >= HIDDEN_ROW ? 2 : 1) : 0) : 0)
|
||||||
#define POS_HORZ_INIT(posVert) ((COLATTR(posVert) & NAVIGATION_LINE_BY_LINE) ? -1 : 0)
|
#define POS_HORZ_INIT(posVert) ((COLATTR(posVert) & NAVIGATION_LINE_BY_LINE) ? -1 : 0)
|
||||||
#define EDIT_MODE_INIT 0 // TODO enum
|
#define EDIT_MODE_INIT 0 // TODO enum
|
||||||
|
|
||||||
typedef int16_t (*FnFuncP) (int16_t x);
|
typedef int16_t (*FnFuncP) (int16_t x);
|
||||||
void DrawFunction(FnFuncP fn, uint8_t offset=0);
|
void DrawFunction(FnFuncP fn, uint8_t offset=0);
|
||||||
|
|
|
@ -422,7 +422,7 @@ void check(const char *name, check_event_t event, uint8_t curr, const MenuFuncP
|
||||||
{
|
{
|
||||||
case EVT_ENTRY:
|
case EVT_ENTRY:
|
||||||
menuEntryTime = get_tmr10ms();
|
menuEntryTime = get_tmr10ms();
|
||||||
l_posVert = POS_VERT_INIT;
|
l_posVert = MENU_FIRST_LINE_EDIT;
|
||||||
l_posHorz = POS_HORZ_INIT(l_posVert);
|
l_posHorz = POS_HORZ_INIT(l_posVert);
|
||||||
SET_SCROLLBAR_X(LCD_W-1);
|
SET_SCROLLBAR_X(LCD_W-1);
|
||||||
s_editMode = EDIT_MODE_INIT;
|
s_editMode = EDIT_MODE_INIT;
|
||||||
|
@ -462,7 +462,7 @@ void check(const char *name, check_event_t event, uint8_t curr, const MenuFuncP
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
uint8_t posVertInit = POS_VERT_INIT;
|
uint8_t posVertInit = MENU_FIRST_LINE_EDIT;
|
||||||
if (s_pgOfs != 0 || l_posVert != posVertInit) {
|
if (s_pgOfs != 0 || l_posVert != posVertInit) {
|
||||||
s_pgOfs = 0;
|
s_pgOfs = 0;
|
||||||
l_posVert = posVertInit;
|
l_posVert = posVertInit;
|
||||||
|
@ -495,7 +495,7 @@ void check(const char *name, check_event_t event, uint8_t curr, const MenuFuncP
|
||||||
}
|
}
|
||||||
|
|
||||||
do {
|
do {
|
||||||
INC(l_posVert, POS_VERT_INIT, rowcount-1);
|
INC(l_posVert, MENU_FIRST_LINE_EDIT, rowcount-1);
|
||||||
} while (CURSOR_NOT_ALLOWED_IN_ROW(l_posVert));
|
} while (CURSOR_NOT_ALLOWED_IN_ROW(l_posVert));
|
||||||
|
|
||||||
s_editMode = 0; // if we go down, we must be in this mode
|
s_editMode = 0; // if we go down, we must be in this mode
|
||||||
|
@ -526,7 +526,7 @@ void check(const char *name, check_event_t event, uint8_t curr, const MenuFuncP
|
||||||
}
|
}
|
||||||
|
|
||||||
do {
|
do {
|
||||||
DEC(l_posVert, POS_VERT_INIT, rowcount-1);
|
DEC(l_posVert, MENU_FIRST_LINE_EDIT, rowcount-1);
|
||||||
} while (CURSOR_NOT_ALLOWED_IN_ROW(l_posVert));
|
} while (CURSOR_NOT_ALLOWED_IN_ROW(l_posVert));
|
||||||
|
|
||||||
s_editMode = 0; // if we go up, we must be in this mode
|
s_editMode = 0; // if we go up, we must be in this mode
|
||||||
|
@ -600,17 +600,21 @@ void check(const char *name, check_event_t event, uint8_t curr, const MenuFuncP
|
||||||
lcdDrawScrollbar(scrollbar_X, MENU_HEADER_HEIGHT, LCD_H-MENU_HEADER_HEIGHT, s_pgOfs, linesCount, NUM_BODY_LINES);
|
lcdDrawScrollbar(scrollbar_X, MENU_HEADER_HEIGHT, LCD_H-MENU_HEADER_HEIGHT, s_pgOfs, linesCount, NUM_BODY_LINES);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (name) {
|
||||||
|
title(name);
|
||||||
|
}
|
||||||
|
|
||||||
m_posVert = l_posVert;
|
m_posVert = l_posVert;
|
||||||
m_posHorz = l_posHorz;
|
m_posHorz = l_posHorz;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void check_simple(const char *name, check_event_t event, uint8_t curr, const MenuFuncP *menuTab, uint8_t menuTabSize, vertpos_t rowcount)
|
void check_simple(const char * name, check_event_t event, uint8_t curr, const MenuFuncP *menuTab, uint8_t menuTabSize, vertpos_t rowcount)
|
||||||
{
|
{
|
||||||
check(name, event, curr, menuTab, menuTabSize, 0, 0, rowcount);
|
check(name, event, curr, menuTab, menuTabSize, 0, 0, rowcount);
|
||||||
}
|
}
|
||||||
|
|
||||||
void check_submenu_simple(const char *name, check_event_t event, uint8_t rowcount)
|
void check_submenu_simple(const char * name, check_event_t event, uint8_t rowcount)
|
||||||
{
|
{
|
||||||
check_simple(name, event, 0, 0, 0, rowcount);
|
check_simple(name, event, 0, 0, 0, rowcount);
|
||||||
}
|
}
|
||||||
|
|
|
@ -70,7 +70,7 @@ void displayPopup(const char *title)
|
||||||
|
|
||||||
void message(const pm_char *title, const pm_char *t, const char *last MESSAGE_SOUND_ARG)
|
void message(const pm_char *title, const pm_char *t, const char *last MESSAGE_SOUND_ARG)
|
||||||
{
|
{
|
||||||
lcd_clear();
|
lcdClear();
|
||||||
lcd_bmp(0, 0, asterisk_lbm);
|
lcd_bmp(0, 0, asterisk_lbm);
|
||||||
|
|
||||||
#define MESSAGE_LCD_OFFSET 60
|
#define MESSAGE_LCD_OFFSET 60
|
||||||
|
|
|
@ -45,7 +45,7 @@ const pm_uchar * const splash_lbm = splashdata+4;
|
||||||
|
|
||||||
void displaySplash()
|
void displaySplash()
|
||||||
{
|
{
|
||||||
lcd_clear();
|
lcdClear();
|
||||||
lcd_bmp(0, 0, splash_lbm);
|
lcd_bmp(0, 0, splash_lbm);
|
||||||
|
|
||||||
#if MENUS_LOCK == 1
|
#if MENUS_LOCK == 1
|
||||||
|
|
|
@ -268,12 +268,13 @@ void displayTopBar()
|
||||||
x -= 12;
|
x -= 12;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (TRAINER_CONNECTED() && SLAVE_MODE()) {
|
if (TRAINER_CONNECTED()) {
|
||||||
LCD_NOTIF_ICON(x, ICON_TRAINEE);
|
if (SLAVE_MODE()) {
|
||||||
x -= 12;
|
LCD_NOTIF_ICON(x, ICON_TRAINEE);
|
||||||
}
|
}
|
||||||
else if (TRAINER_CONNECTED() && !SLAVE_MODE()) {
|
else {
|
||||||
LCD_NOTIF_ICON(x, ICON_TRAINER);
|
LCD_NOTIF_ICON(x, ICON_TRAINER);
|
||||||
|
}
|
||||||
x -= 12;
|
x -= 12;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -315,7 +316,7 @@ void displayTimers()
|
||||||
TimerState & timerState = timersStates[i];
|
TimerState & timerState = timersStates[i];
|
||||||
TimerData & timerData = g_model.timers[i];
|
TimerData & timerData = g_model.timers[i];
|
||||||
uint8_t y = TIMERS_Y + i*TIMERS_H;
|
uint8_t y = TIMERS_Y + i*TIMERS_H;
|
||||||
if (zlen(timerData.name, LEN_TIMER_NAME) > 0) {
|
if (ZLEN(timerData.name) > 0) {
|
||||||
lcd_putsnAtt(TIMERS_X, y-7, timerData.name, LEN_TIMER_NAME, ZCHAR|SMLSIZE);
|
lcd_putsnAtt(TIMERS_X, y-7, timerData.name, LEN_TIMER_NAME, ZCHAR|SMLSIZE);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
|
@ -42,7 +42,7 @@ const pm_uchar bmp_sleep[] PROGMEM = {
|
||||||
|
|
||||||
void displaySleepBitmap()
|
void displaySleepBitmap()
|
||||||
{
|
{
|
||||||
lcd_clear();
|
lcdClear();
|
||||||
lcd_bmp(76, 2, bmp_sleep, 0, 60);
|
lcd_bmp(76, 2, bmp_sleep, 0, 60);
|
||||||
lcdRefresh();
|
lcdRefresh();
|
||||||
}
|
}
|
||||||
|
|
|
@ -417,7 +417,7 @@ static int luaLcdLock(lua_State *L)
|
||||||
|
|
||||||
static int luaLcdClear(lua_State *L)
|
static int luaLcdClear(lua_State *L)
|
||||||
{
|
{
|
||||||
if (luaLcdAllowed) lcd_clear();
|
if (luaLcdAllowed) lcdClear();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -107,66 +107,7 @@ void checkEeprom()
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(PCBFLAMENCO)
|
#if defined(GUI)
|
||||||
void guiMain(evt_t evt)
|
|
||||||
{
|
|
||||||
lcd_clear();
|
|
||||||
|
|
||||||
#if defined(LUA)
|
|
||||||
uint32_t t0 = get_tmr10ms();
|
|
||||||
static uint32_t lastLuaTime = 0;
|
|
||||||
uint16_t interval = (lastLuaTime == 0 ? 0 : (t0 - lastLuaTime));
|
|
||||||
lastLuaTime = t0;
|
|
||||||
if (interval > maxLuaInterval) {
|
|
||||||
maxLuaInterval = interval;
|
|
||||||
}
|
|
||||||
|
|
||||||
// run Lua scripts that don't use LCD (to use CPU time while LCD DMA is running)
|
|
||||||
luaTask(0, RUN_MIX_SCRIPT | RUN_FUNC_SCRIPT | RUN_TELEM_BG_SCRIPT, false);
|
|
||||||
|
|
||||||
// wait for LCD DMA to finish before continuing, because code from this point
|
|
||||||
// is allowed to change the contents of LCD buffer
|
|
||||||
//
|
|
||||||
// WARNING: make sure no code above this line does any change to the LCD display buffer!
|
|
||||||
//
|
|
||||||
|
|
||||||
bool scriptWasRun = luaTask(evt, RUN_STNDAL_SCRIPT, true);
|
|
||||||
|
|
||||||
t0 = get_tmr10ms() - t0;
|
|
||||||
if (t0 > maxLuaDuration) {
|
|
||||||
maxLuaDuration = t0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!scriptWasRun)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
{
|
|
||||||
// normal GUI from menus
|
|
||||||
const char *warn = s_warning;
|
|
||||||
uint8_t menu = s_menu_count;
|
|
||||||
// lcd_clear();
|
|
||||||
if (menuEvent) {
|
|
||||||
m_posVert = menuEvent == EVT_ENTRY_UP ? g_menuPos[g_menuStackPtr] : 0;
|
|
||||||
m_posHorz = 0;
|
|
||||||
evt = menuEvent;
|
|
||||||
menuEvent = 0;
|
|
||||||
AUDIO_MENUS();
|
|
||||||
}
|
|
||||||
g_menuStack[g_menuStackPtr]((warn || menu) ? 0 : evt);
|
|
||||||
if (warn) DISPLAY_WARNING(evt);
|
|
||||||
if (menu) {
|
|
||||||
const char * result = displayMenu(evt);
|
|
||||||
if (result) {
|
|
||||||
menuHandler(result);
|
|
||||||
putEvent(EVT_MENU_UP);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
drawStatusLine();
|
|
||||||
}
|
|
||||||
|
|
||||||
lcdRefresh();
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
void guiMain(evt_t evt)
|
void guiMain(evt_t evt)
|
||||||
{
|
{
|
||||||
#if defined(LUA)
|
#if defined(LUA)
|
||||||
|
@ -192,40 +133,27 @@ void guiMain(evt_t evt)
|
||||||
// run Lua scripts that use LCD
|
// run Lua scripts that use LCD
|
||||||
|
|
||||||
bool standaloneScriptWasRun = luaTask(evt, RUN_STNDAL_SCRIPT, true);
|
bool standaloneScriptWasRun = luaTask(evt, RUN_STNDAL_SCRIPT, true);
|
||||||
bool refreshScreen = true;
|
|
||||||
if (!standaloneScriptWasRun) {
|
if (!standaloneScriptWasRun) {
|
||||||
refreshScreen = !luaTask(evt, RUN_TELEM_FG_SCRIPT, true);
|
luaTask(evt, RUN_TELEM_FG_SCRIPT, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
t0 = get_tmr10ms() - t0;
|
t0 = get_tmr10ms() - t0;
|
||||||
if (t0 > maxLuaDuration) {
|
if (t0 > maxLuaDuration) {
|
||||||
maxLuaDuration = t0;
|
maxLuaDuration = t0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!standaloneScriptWasRun)
|
|
||||||
#else
|
#else
|
||||||
lcdRefreshWait(); // WARNING: make sure no code above this line does any change to the LCD display buffer!
|
lcdRefreshWait(); // WARNING: make sure no code above this line does any change to the LCD display buffer!
|
||||||
const bool refreshScreen = true;
|
const bool standaloneScriptWasRun = false;
|
||||||
#endif
|
#endif
|
||||||
{
|
|
||||||
#if defined(PCBHORUS)
|
if (!standaloneScriptWasRun) {
|
||||||
for (int i=0; i<2; i++) {
|
while (1) {
|
||||||
|
#if !defined(COLORLCD)
|
||||||
|
lcdClear();
|
||||||
#endif
|
#endif
|
||||||
// normal GUI from menus
|
// normal GUI from menus
|
||||||
const char *warn = s_warning;
|
const char * warn = s_warning;
|
||||||
uint8_t menu = s_menu_count;
|
uint8_t menu = s_menu_count;
|
||||||
#if !defined(COLORLCD)
|
|
||||||
if (refreshScreen) {
|
|
||||||
lcd_clear();
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
if (menuEvent) {
|
|
||||||
m_posVert = menuEvent == EVT_ENTRY_UP ? g_menuPos[g_menuStackPtr] : -1;
|
|
||||||
m_posHorz = 0;
|
|
||||||
evt = menuEvent;
|
|
||||||
menuEvent = 0;
|
|
||||||
AUDIO_MENUS();
|
|
||||||
}
|
|
||||||
g_menuStack[g_menuStackPtr]((warn || menu) ? 0 : evt);
|
g_menuStack[g_menuStackPtr]((warn || menu) ? 0 : evt);
|
||||||
if (warn) DISPLAY_WARNING(evt);
|
if (warn) DISPLAY_WARNING(evt);
|
||||||
if (menu) {
|
if (menu) {
|
||||||
|
@ -236,11 +164,22 @@ void guiMain(evt_t evt)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
drawStatusLine();
|
drawStatusLine();
|
||||||
#if defined(PCBHORUS)
|
if (menuEvent == EVT_ENTRY) {
|
||||||
if (menuEvent != EVT_ENTRY || menuEvent != EVT_ENTRY_UP)
|
m_posVert = -1;
|
||||||
|
m_posHorz = 0;
|
||||||
|
evt = menuEvent;
|
||||||
|
menuEvent = 0;
|
||||||
|
}
|
||||||
|
else if (menuEvent == EVT_ENTRY_UP) {
|
||||||
|
m_posVert = g_menuPos[g_menuStackPtr];
|
||||||
|
m_posHorz = 0;
|
||||||
|
evt = menuEvent;
|
||||||
|
menuEvent = 0;
|
||||||
|
}
|
||||||
|
else {
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
lcdRefresh();
|
lcdRefresh();
|
||||||
|
@ -271,7 +210,7 @@ void perMain()
|
||||||
#if defined(USB_MASS_STORAGE)
|
#if defined(USB_MASS_STORAGE)
|
||||||
if (usbPlugged()) {
|
if (usbPlugged()) {
|
||||||
// disable access to menus
|
// disable access to menus
|
||||||
lcd_clear();
|
lcdClear();
|
||||||
menuMainView(0);
|
menuMainView(0);
|
||||||
lcdRefresh();
|
lcdRefresh();
|
||||||
return;
|
return;
|
||||||
|
@ -290,13 +229,13 @@ void perMain()
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(PCBTARANIS) && defined(REV9E) && !defined(SIMU)
|
#if defined(PCBTARANIS) && defined(REV9E) && !defined(SIMU)
|
||||||
topLcdRefreshStart();
|
toplcdRefreshStart();
|
||||||
setTopFirstTimer(getValue(MIXSRC_FIRST_TIMER+g_model.topLcdTimer));
|
setTopFirstTimer(getValue(MIXSRC_FIRST_TIMER+g_model.toplcdTimer));
|
||||||
setTopSecondTimer(g_eeGeneral.globalTimer + sessionTimer);
|
setTopSecondTimer(g_eeGeneral.globalTimer + sessionTimer);
|
||||||
setTopRssi(TELEMETRY_RSSI());
|
setTopRssi(TELEMETRY_RSSI());
|
||||||
setTopBatteryValue(g_vbat100mV);
|
setTopBatteryValue(g_vbat100mV);
|
||||||
setTopBatteryState(GET_TXBATT_BARS(), IS_TXBATT_WARNING());
|
setTopBatteryState(GET_TXBATT_BARS(), IS_TXBATT_WARNING());
|
||||||
topLcdRefreshEnd();
|
toplcdRefreshEnd();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(PCBTARANIS) && defined(REV9E) && !defined(SIMU)
|
#if defined(PCBTARANIS) && defined(REV9E) && !defined(SIMU)
|
||||||
|
|
|
@ -129,7 +129,7 @@ void perMain()
|
||||||
const char *warn = s_warning;
|
const char *warn = s_warning;
|
||||||
uint8_t menu = s_menu_count;
|
uint8_t menu = s_menu_count;
|
||||||
|
|
||||||
lcd_clear();
|
lcdClear();
|
||||||
if (menuEvent) {
|
if (menuEvent) {
|
||||||
m_posVert = menuEvent == EVT_ENTRY_UP ? g_menuPos[g_menuStackPtr] : 0;
|
m_posVert = menuEvent == EVT_ENTRY_UP ? g_menuPos[g_menuStackPtr] : 0;
|
||||||
m_posHorz = 0;
|
m_posHorz = 0;
|
||||||
|
|
|
@ -2333,7 +2333,7 @@ PACK(typedef struct {
|
||||||
|
|
||||||
ARM_FIELD(TelemetrySensor telemetrySensors[MAX_SENSORS])
|
ARM_FIELD(TelemetrySensor telemetrySensors[MAX_SENSORS])
|
||||||
|
|
||||||
TARANIS_REV9E_FIELD(uint8_t topLcdTimer)
|
TARANIS_REV9E_FIELD(uint8_t toplcdTimer)
|
||||||
}) ModelData;
|
}) ModelData;
|
||||||
|
|
||||||
extern EEGeneral g_eeGeneral;
|
extern EEGeneral g_eeGeneral;
|
||||||
|
|
|
@ -1925,7 +1925,7 @@ void opentxClose()
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined(PCBTARANIS)
|
#if !defined(PCBTARANIS)
|
||||||
if (s_storageDirtyMsk & EE_MODEL) {
|
if (storageDirtyMsk & EE_MODEL) {
|
||||||
displayPopup(STR_SAVEMODEL);
|
displayPopup(STR_SAVEMODEL);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -2607,10 +2607,10 @@ int main(void)
|
||||||
|
|
||||||
#if defined(CPUM2560)
|
#if defined(CPUM2560)
|
||||||
// Time to switch off
|
// Time to switch off
|
||||||
lcd_clear();
|
lcdClear();
|
||||||
displayPopup(STR_SHUTDOWN);
|
displayPopup(STR_SHUTDOWN);
|
||||||
opentxClose();
|
opentxClose();
|
||||||
lcd_clear() ;
|
lcdClear() ;
|
||||||
lcdRefresh() ;
|
lcdRefresh() ;
|
||||||
boardOff(); // Only turn power off if necessary
|
boardOff(); // Only turn power off if necessary
|
||||||
wdt_disable();
|
wdt_disable();
|
||||||
|
@ -2663,7 +2663,7 @@ uint32_t pwrCheck()
|
||||||
#if defined(SHUTDOWN_CONFIRMATION)
|
#if defined(SHUTDOWN_CONFIRMATION)
|
||||||
while (1) {
|
while (1) {
|
||||||
lcdRefreshWait();
|
lcdRefreshWait();
|
||||||
lcd_clear();
|
lcdClear();
|
||||||
POPUP_CONFIRMATION("Confirm Shutdown");
|
POPUP_CONFIRMATION("Confirm Shutdown");
|
||||||
evt_t evt = getEvent(false);
|
evt_t evt = getEvent(false);
|
||||||
DISPLAY_WARNING(evt);
|
DISPLAY_WARNING(evt);
|
||||||
|
@ -2687,7 +2687,7 @@ uint32_t pwrCheck()
|
||||||
else {
|
else {
|
||||||
lcdRefreshWait();
|
lcdRefreshWait();
|
||||||
unsigned index = pwrPressedDuration() / (PWR_PRESS_SHUTDOWN / 4);
|
unsigned index = pwrPressedDuration() / (PWR_PRESS_SHUTDOWN / 4);
|
||||||
lcd_clear();
|
lcdClear();
|
||||||
lcd_bmp(76, 2, bmp_shutdown, index*60, 60);
|
lcd_bmp(76, 2, bmp_shutdown, index*60, 60);
|
||||||
lcdRefresh();
|
lcdRefresh();
|
||||||
return e_power_press;
|
return e_power_press;
|
||||||
|
|
|
@ -747,7 +747,7 @@ PACK(typedef struct {
|
||||||
|
|
||||||
TelemetrySensor telemetrySensors[MAX_SENSORS];
|
TelemetrySensor telemetrySensors[MAX_SENSORS];
|
||||||
|
|
||||||
TARANIS_REV9E_FIELD(uint8_t topLcdTimer)
|
TARANIS_REV9E_FIELD(uint8_t toplcdTimer)
|
||||||
}) ModelData_v217;
|
}) ModelData_v217;
|
||||||
|
|
||||||
#if defined(PCBTARANIS)
|
#if defined(PCBTARANIS)
|
||||||
|
@ -1356,7 +1356,7 @@ void ConvertModel_217_to_218(ModelData & model)
|
||||||
newModel.telemetrySensors[i] = oldModel.telemetrySensors[i];
|
newModel.telemetrySensors[i] = oldModel.telemetrySensors[i];
|
||||||
}
|
}
|
||||||
#if defined(PCBTARANIS) && defined(REV9E)
|
#if defined(PCBTARANIS) && defined(REV9E)
|
||||||
newModel.topLcdTimer = oldModel.topLcdTimer;
|
newModel.toplcdTimer = oldModel.toplcdTimer;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1375,7 +1375,7 @@ void ConvertModel(int id, int version)
|
||||||
|
|
||||||
uint8_t currModel = g_eeGeneral.currModel;
|
uint8_t currModel = g_eeGeneral.currModel;
|
||||||
g_eeGeneral.currModel = id;
|
g_eeGeneral.currModel = id;
|
||||||
s_storageDirtyMsk = EE_MODEL;
|
storageDirty(EE_MODEL);
|
||||||
storageCheck(true);
|
storageCheck(true);
|
||||||
g_eeGeneral.currModel = currModel;
|
g_eeGeneral.currModel = currModel;
|
||||||
}
|
}
|
||||||
|
@ -1421,7 +1421,7 @@ bool eeConvert()
|
||||||
version = 218;
|
version = 218;
|
||||||
ConvertGeneralSettings_217_to_218(g_eeGeneral);
|
ConvertGeneralSettings_217_to_218(g_eeGeneral);
|
||||||
}
|
}
|
||||||
s_storageDirtyMsk = EE_GENERAL;
|
storageDirty(EE_GENERAL);
|
||||||
storageCheck(true);
|
storageCheck(true);
|
||||||
|
|
||||||
#if defined(COLORLCD)
|
#if defined(COLORLCD)
|
||||||
|
|
|
@ -375,9 +375,9 @@ void storageCheck(bool immediately)
|
||||||
|
|
||||||
assert(eepromWriteState == EEPROM_IDLE);
|
assert(eepromWriteState == EEPROM_IDLE);
|
||||||
|
|
||||||
if (s_storageDirtyMsk & EE_GENERAL) {
|
if (storageDirtyMsk & EE_GENERAL) {
|
||||||
TRACE("eeprom write general");
|
TRACE("eeprom write general");
|
||||||
s_storageDirtyMsk -= EE_GENERAL;
|
storageDirtyMsk -= EE_GENERAL;
|
||||||
writeGeneralSettings();
|
writeGeneralSettings();
|
||||||
if (immediately)
|
if (immediately)
|
||||||
eepromWriteWait();
|
eepromWriteWait();
|
||||||
|
@ -385,9 +385,9 @@ void storageCheck(bool immediately)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (s_storageDirtyMsk & EE_MODEL) {
|
if (storageDirtyMsk & EE_MODEL) {
|
||||||
TRACE("eeprom write model");
|
TRACE("eeprom write model");
|
||||||
s_storageDirtyMsk -= EE_MODEL;
|
storageDirtyMsk -= EE_MODEL;
|
||||||
writeModel(g_eeGeneral.currModel);
|
writeModel(g_eeGeneral.currModel);
|
||||||
if (immediately)
|
if (immediately)
|
||||||
eepromWriteWait();
|
eepromWriteWait();
|
||||||
|
|
|
@ -865,8 +865,8 @@ void RlcFile::flush()
|
||||||
#if defined (EEPROM_PROGRESS_BAR)
|
#if defined (EEPROM_PROGRESS_BAR)
|
||||||
void RlcFile::DisplayProgressBar(uint8_t x)
|
void RlcFile::DisplayProgressBar(uint8_t x)
|
||||||
{
|
{
|
||||||
if (s_storageDirtyMsk || isWriting() || eeprom_buffer_size) {
|
if (storageDirtyMsk || isWriting() || eeprom_buffer_size) {
|
||||||
uint8_t len = s_storageDirtyMsk ? 1 : limit((uint8_t)1, (uint8_t)(7 - (m_rlc_len/m_ratio)), (uint8_t)7);
|
uint8_t len = storageDirtyMsk ? 1 : limit((uint8_t)1, (uint8_t)(7 - (m_rlc_len/m_ratio)), (uint8_t)7);
|
||||||
drawFilledRect(x+1, 0, 5, FH, SOLID, ERASE);
|
drawFilledRect(x+1, 0, 5, FH, SOLID, ERASE);
|
||||||
drawFilledRect(x+2, 7-len, 3, len);
|
drawFilledRect(x+2, 7-len, 3, len);
|
||||||
}
|
}
|
||||||
|
@ -940,16 +940,16 @@ void storageCheck(bool immediately)
|
||||||
eeFlush();
|
eeFlush();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (s_storageDirtyMsk & EE_GENERAL) {
|
if (storageDirtyMsk & EE_GENERAL) {
|
||||||
TRACE("eeprom write general");
|
TRACE("eeprom write general");
|
||||||
s_storageDirtyMsk -= EE_GENERAL;
|
storageDirtyMsk -= EE_GENERAL;
|
||||||
theFile.writeRlc(FILE_GENERAL, FILE_TYP_GENERAL, (uint8_t*)&g_eeGeneral, sizeof(EEGeneral), immediately);
|
theFile.writeRlc(FILE_GENERAL, FILE_TYP_GENERAL, (uint8_t*)&g_eeGeneral, sizeof(EEGeneral), immediately);
|
||||||
if (!immediately) return;
|
if (!immediately) return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (s_storageDirtyMsk & EE_MODEL) {
|
if (storageDirtyMsk & EE_MODEL) {
|
||||||
TRACE("eeprom write model");
|
TRACE("eeprom write model");
|
||||||
s_storageDirtyMsk = 0;
|
storageDirtyMsk = 0;
|
||||||
theFile.writeRlc(FILE_MODEL(g_eeGeneral.currModel), FILE_TYP_MODEL, (uint8_t*)&g_model, sizeof(g_model), immediately);
|
theFile.writeRlc(FILE_MODEL(g_eeGeneral.currModel), FILE_TYP_MODEL, (uint8_t*)&g_model, sizeof(g_model), immediately);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -165,9 +165,9 @@ void storageCheck(bool immediately)
|
||||||
// eepromWriteWait();
|
// eepromWriteWait();
|
||||||
// }
|
// }
|
||||||
|
|
||||||
if (s_storageDirtyMsk & EE_GENERAL) {
|
if (storageDirtyMsk & EE_GENERAL) {
|
||||||
TRACE("eeprom write general");
|
TRACE("eeprom write general");
|
||||||
s_storageDirtyMsk -= EE_GENERAL;
|
storageDirtyMsk -= EE_GENERAL;
|
||||||
writeGeneralSettings();
|
writeGeneralSettings();
|
||||||
// if (immediately)
|
// if (immediately)
|
||||||
// eepromWriteWait();
|
// eepromWriteWait();
|
||||||
|
@ -175,9 +175,9 @@ void storageCheck(bool immediately)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (s_storageDirtyMsk & EE_MODEL) {
|
if (storageDirtyMsk & EE_MODEL) {
|
||||||
TRACE("eeprom write model");
|
TRACE("eeprom write model");
|
||||||
s_storageDirtyMsk -= EE_MODEL;
|
storageDirtyMsk -= EE_MODEL;
|
||||||
const char * error = writeModel();
|
const char * error = writeModel();
|
||||||
if (error) {
|
if (error) {
|
||||||
TRACE("writeModel error=%s", error);
|
TRACE("writeModel error=%s", error);
|
||||||
|
|
|
@ -49,10 +49,10 @@
|
||||||
#define WRITE_DELAY_10MS 200
|
#define WRITE_DELAY_10MS 200
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern uint8_t s_storageDirtyMsk;
|
extern uint8_t storageDirtyMsk;
|
||||||
extern tmr10ms_t s_storageDirtyTime10ms;
|
extern tmr10ms_t storageDirtyTime10ms;
|
||||||
|
|
||||||
#define TIME_TO_WRITE() (s_storageDirtyMsk && (tmr10ms_t)(get_tmr10ms() - s_storageDirtyTime10ms) >= (tmr10ms_t)WRITE_DELAY_10MS)
|
#define TIME_TO_WRITE() (storageDirtyMsk && (tmr10ms_t)(get_tmr10ms() - storageDirtyTime10ms) >= (tmr10ms_t)WRITE_DELAY_10MS)
|
||||||
|
|
||||||
void storageEraseAll(bool warn);
|
void storageEraseAll(bool warn);
|
||||||
void storageFormat();
|
void storageFormat();
|
||||||
|
|
|
@ -36,13 +36,13 @@
|
||||||
|
|
||||||
#include "../opentx.h"
|
#include "../opentx.h"
|
||||||
|
|
||||||
uint8_t s_storageDirtyMsk;
|
uint8_t storageDirtyMsk;
|
||||||
tmr10ms_t s_storageDirtyTime10ms;
|
tmr10ms_t storageDirtyTime10ms;
|
||||||
|
|
||||||
void storageDirty(uint8_t msk)
|
void storageDirty(uint8_t msk)
|
||||||
{
|
{
|
||||||
s_storageDirtyMsk |= msk;
|
storageDirtyMsk |= msk;
|
||||||
s_storageDirtyTime10ms = get_tmr10ms() ;
|
storageDirtyTime10ms = get_tmr10ms() ;
|
||||||
}
|
}
|
||||||
|
|
||||||
void preModelLoad()
|
void preModelLoad()
|
||||||
|
|
|
@ -157,7 +157,7 @@ void boardInit()
|
||||||
|
|
||||||
#if defined(REV9E)
|
#if defined(REV9E)
|
||||||
if (!WAS_RESET_BY_WATCHDOG_OR_SOFTWARE()) {
|
if (!WAS_RESET_BY_WATCHDOG_OR_SOFTWARE()) {
|
||||||
lcd_clear();
|
lcdClear();
|
||||||
lcd_bmp(76, 2, bmp_lock, 0, 60);
|
lcd_bmp(76, 2, bmp_lock, 0, 60);
|
||||||
lcdRefresh();
|
lcdRefresh();
|
||||||
lcdRefreshWait();
|
lcdRefreshWait();
|
||||||
|
@ -169,7 +169,7 @@ void boardInit()
|
||||||
duration = get_tmr10ms() - start;
|
duration = get_tmr10ms() - start;
|
||||||
if (duration < PWR_PRESS_DURATION_MIN) {
|
if (duration < PWR_PRESS_DURATION_MIN) {
|
||||||
unsigned index = duration / (PWR_PRESS_DURATION_MIN / 4);
|
unsigned index = duration / (PWR_PRESS_DURATION_MIN / 4);
|
||||||
lcd_clear();
|
lcdClear();
|
||||||
lcd_bmp(76, 2, bmp_startup, index*60, 60);
|
lcd_bmp(76, 2, bmp_startup, index*60, 60);
|
||||||
}
|
}
|
||||||
else if (duration >= PWR_PRESS_DURATION_MAX) {
|
else if (duration >= PWR_PRESS_DURATION_MAX) {
|
||||||
|
@ -193,7 +193,7 @@ void boardInit()
|
||||||
else {
|
else {
|
||||||
backlightInit();
|
backlightInit();
|
||||||
}
|
}
|
||||||
topLcdInit();
|
toplcdInit();
|
||||||
#else
|
#else
|
||||||
backlightInit();
|
backlightInit();
|
||||||
#endif
|
#endif
|
||||||
|
@ -203,7 +203,7 @@ void boardOff()
|
||||||
{
|
{
|
||||||
BACKLIGHT_OFF();
|
BACKLIGHT_OFF();
|
||||||
#if defined(REV9E)
|
#if defined(REV9E)
|
||||||
topLcdOff();
|
toplcdOff();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(REV9E)
|
#if defined(REV9E)
|
||||||
|
|
|
@ -347,10 +347,10 @@ void lcdOff(void);
|
||||||
|
|
||||||
// Top LCD driver
|
// Top LCD driver
|
||||||
#if defined(REV9E)
|
#if defined(REV9E)
|
||||||
void topLcdInit(void);
|
void toplcdInit(void);
|
||||||
void topLcdOff(void);
|
void toplcdOff(void);
|
||||||
void topLcdRefreshStart(void);
|
void toplcdRefreshStart(void);
|
||||||
void topLcdRefreshEnd(void);
|
void toplcdRefreshEnd(void);
|
||||||
void setTopFirstTimer(int32_t value);
|
void setTopFirstTimer(int32_t value);
|
||||||
void setTopSecondTimer(uint32_t value);
|
void setTopSecondTimer(uint32_t value);
|
||||||
void setTopRssi(uint32_t rssi);
|
void setTopRssi(uint32_t rssi);
|
||||||
|
|
|
@ -402,7 +402,7 @@ int main()
|
||||||
lcdInit();
|
lcdInit();
|
||||||
backlightInit();
|
backlightInit();
|
||||||
|
|
||||||
lcd_clear();
|
lcdClear();
|
||||||
lcd_putsn(0, 0, (const char *)bootloaderVersion, 0); // trick to avoid bootloaderVersion to be optimized out ...
|
lcd_putsn(0, 0, (const char *)bootloaderVersion, 0); // trick to avoid bootloaderVersion to be optimized out ...
|
||||||
lcd_putsLeft(0, BOOTLOADER_TITLE);
|
lcd_putsLeft(0, BOOTLOADER_TITLE);
|
||||||
lcd_invert_line(0);
|
lcd_invert_line(0);
|
||||||
|
@ -427,7 +427,7 @@ int main()
|
||||||
Tenms = 0;
|
Tenms = 0;
|
||||||
|
|
||||||
lcdRefreshWait();
|
lcdRefreshWait();
|
||||||
lcd_clear();
|
lcdClear();
|
||||||
lcd_putsLeft(0, BOOTLOADER_TITLE);
|
lcd_putsLeft(0, BOOTLOADER_TITLE);
|
||||||
lcd_invert_line(0);
|
lcd_invert_line(0);
|
||||||
|
|
||||||
|
@ -686,7 +686,7 @@ int main()
|
||||||
|
|
||||||
if (state == ST_REBOOT) {
|
if (state == ST_REBOOT) {
|
||||||
if (readKeys() == 0) {
|
if (readKeys() == 0) {
|
||||||
lcd_clear();
|
lcdClear();
|
||||||
lcdRefresh();
|
lcdRefresh();
|
||||||
lcdRefreshWait();
|
lcdRefreshWait();
|
||||||
RCC->CSR |= RCC_CSR_RMVF; //clear the reset flags in RCC clock control & status register
|
RCC->CSR |= RCC_CSR_RMVF; //clear the reset flags in RCC clock control & status register
|
||||||
|
|
|
@ -233,7 +233,7 @@ extern "C" void TIM8_BRK_TIM12_IRQHandler()
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void topLcdInit()
|
void toplcdInit()
|
||||||
{
|
{
|
||||||
RCC_AHB1PeriphClockCmd(TOPLCD_RCC_AHB1Periph, ENABLE);
|
RCC_AHB1PeriphClockCmd(TOPLCD_RCC_AHB1Periph, ENABLE);
|
||||||
GPIO_InitTypeDef GPIO_InitStructure;
|
GPIO_InitTypeDef GPIO_InitStructure;
|
||||||
|
@ -254,15 +254,15 @@ void topLcdInit()
|
||||||
ht1621SendCommand(1, 0x01);
|
ht1621SendCommand(1, 0x01);
|
||||||
ht1621SendCommand(1, 0x29);
|
ht1621SendCommand(1, 0x29);
|
||||||
|
|
||||||
topLcdRefreshStart();
|
toplcdRefreshStart();
|
||||||
topLcdRefreshEnd();
|
toplcdRefreshEnd();
|
||||||
}
|
}
|
||||||
|
|
||||||
void topLcdOff()
|
void toplcdOff()
|
||||||
{
|
{
|
||||||
BL_OFF();
|
BL_OFF();
|
||||||
topLcdRefreshStart();
|
toplcdRefreshStart();
|
||||||
topLcdRefreshEnd();
|
toplcdRefreshEnd();
|
||||||
}
|
}
|
||||||
|
|
||||||
void setTopFirstTimer(int32_t value)
|
void setTopFirstTimer(int32_t value)
|
||||||
|
@ -419,13 +419,13 @@ void setTopSecondTimer(uint32_t value)
|
||||||
Ht1621Data1[3] |= 0x10; // "Operation Time"
|
Ht1621Data1[3] |= 0x10; // "Operation Time"
|
||||||
}
|
}
|
||||||
|
|
||||||
void topLcdRefreshStart()
|
void toplcdRefreshStart()
|
||||||
{
|
{
|
||||||
memset(Ht1621Data1, 0, sizeof(Ht1621Data1));
|
memset(Ht1621Data1, 0, sizeof(Ht1621Data1));
|
||||||
memset(Ht1621Data2, 0, sizeof(Ht1621Data2));
|
memset(Ht1621Data2, 0, sizeof(Ht1621Data2));
|
||||||
}
|
}
|
||||||
|
|
||||||
void topLcdRefreshEnd()
|
void toplcdRefreshEnd()
|
||||||
{
|
{
|
||||||
ht1621WrAllData(0, Ht1621Data1);
|
ht1621WrAllData(0, Ht1621Data1);
|
||||||
ht1621WrAllData(1, Ht1621Data2);
|
ht1621WrAllData(1, Ht1621Data2);
|
||||||
|
|
|
@ -192,7 +192,7 @@ void menusTask(void * pdata)
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(PCBTARANIS) && defined(REV9E)
|
#if defined(PCBTARANIS) && defined(REV9E)
|
||||||
topLcdOff();
|
toplcdOff();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
BACKLIGHT_OFF();
|
BACKLIGHT_OFF();
|
||||||
|
@ -201,7 +201,7 @@ void menusTask(void * pdata)
|
||||||
#elif defined(PCBTARANIS)
|
#elif defined(PCBTARANIS)
|
||||||
displaySleepBitmap();
|
displaySleepBitmap();
|
||||||
#else
|
#else
|
||||||
lcd_clear();
|
lcdClear();
|
||||||
displayPopup(STR_SHUTDOWN);
|
displayPopup(STR_SHUTDOWN);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -341,7 +341,7 @@ TEST(FrSkySPORT, frskySetCellVoltage)
|
||||||
EXPECT_EQ(telemetryItems[0].valueMax, 2071);
|
EXPECT_EQ(telemetryItems[0].valueMax, 2071);
|
||||||
|
|
||||||
//display test
|
//display test
|
||||||
lcd_clear();
|
lcdClear();
|
||||||
g_model.frsky.voltsSource = FRSKY_VOLTS_SOURCE_A1;
|
g_model.frsky.voltsSource = FRSKY_VOLTS_SOURCE_A1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -416,7 +416,7 @@ TEST(FrSkySPORT, frskySetCellVoltageTwoSensors)
|
||||||
EXPECT_EQ(telemetryItems[2].valueMax, 287);
|
EXPECT_EQ(telemetryItems[2].valueMax, 287);
|
||||||
|
|
||||||
//display test
|
//display test
|
||||||
lcd_clear();
|
lcdClear();
|
||||||
g_model.frsky.voltsSource = FRSKY_VOLTS_SOURCE_A1;
|
g_model.frsky.voltsSource = FRSKY_VOLTS_SOURCE_A1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -114,7 +114,7 @@ bool checkScreenshot(const QString & test)
|
||||||
|
|
||||||
TEST(outdezNAtt, test_unsigned)
|
TEST(outdezNAtt, test_unsigned)
|
||||||
{
|
{
|
||||||
lcd_clear();
|
lcdClear();
|
||||||
lcd_outdezNAtt(0, 0, 65530, LEFT|UNSIGN);
|
lcd_outdezNAtt(0, 0, 65530, LEFT|UNSIGN);
|
||||||
EXPECT_TRUE(checkScreenshot("unsigned")) << "Unsigned numbers will be bad displayed";
|
EXPECT_TRUE(checkScreenshot("unsigned")) << "Unsigned numbers will be bad displayed";
|
||||||
}
|
}
|
||||||
|
@ -122,7 +122,7 @@ TEST(outdezNAtt, test_unsigned)
|
||||||
#if defined(CPUARM)
|
#if defined(CPUARM)
|
||||||
TEST(outdezNAtt, testBigNumbers)
|
TEST(outdezNAtt, testBigNumbers)
|
||||||
{
|
{
|
||||||
lcd_clear();
|
lcdClear();
|
||||||
lcd_outdezNAtt(0, 0, 1234567, LEFT);
|
lcd_outdezNAtt(0, 0, 1234567, LEFT);
|
||||||
lcd_outdezNAtt(0, FH, -1234567, LEFT);
|
lcd_outdezNAtt(0, FH, -1234567, LEFT);
|
||||||
EXPECT_TRUE(checkScreenshot("big_numbers"));
|
EXPECT_TRUE(checkScreenshot("big_numbers"));
|
||||||
|
@ -132,28 +132,28 @@ TEST(outdezNAtt, testBigNumbers)
|
||||||
|
|
||||||
TEST(Lcd, Invers_0_0)
|
TEST(Lcd, Invers_0_0)
|
||||||
{
|
{
|
||||||
lcd_clear();
|
lcdClear();
|
||||||
lcd_putsAtt(0, 0, "Test", INVERS);
|
lcd_putsAtt(0, 0, "Test", INVERS);
|
||||||
EXPECT_TRUE(checkScreenshot("invers_0_0"));
|
EXPECT_TRUE(checkScreenshot("invers_0_0"));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(Lcd, Invers_0_1)
|
TEST(Lcd, Invers_0_1)
|
||||||
{
|
{
|
||||||
lcd_clear();
|
lcdClear();
|
||||||
lcd_putsAtt(0, 1, "Test", INVERS);
|
lcd_putsAtt(0, 1, "Test", INVERS);
|
||||||
EXPECT_TRUE(checkScreenshot("invers_0_1"));
|
EXPECT_TRUE(checkScreenshot("invers_0_1"));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(Lcd, Prec2_Left)
|
TEST(Lcd, Prec2_Left)
|
||||||
{
|
{
|
||||||
lcd_clear();
|
lcdClear();
|
||||||
lcd_outdezAtt(0, 0, 2, PREC2|LEFT);
|
lcd_outdezAtt(0, 0, 2, PREC2|LEFT);
|
||||||
EXPECT_TRUE(checkScreenshot("prec2_left"));
|
EXPECT_TRUE(checkScreenshot("prec2_left"));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(Lcd, Prec2_Right)
|
TEST(Lcd, Prec2_Right)
|
||||||
{
|
{
|
||||||
lcd_clear();
|
lcdClear();
|
||||||
lcd_outdezAtt(LCD_W, LCD_H-FH, 2, PREC2);
|
lcd_outdezAtt(LCD_W, LCD_H-FH, 2, PREC2);
|
||||||
EXPECT_TRUE(checkScreenshot("prec2_right"));
|
EXPECT_TRUE(checkScreenshot("prec2_right"));
|
||||||
}
|
}
|
||||||
|
@ -161,7 +161,7 @@ TEST(Lcd, Prec2_Right)
|
||||||
#if defined(CPUARM)
|
#if defined(CPUARM)
|
||||||
TEST(Lcd, Prec1_Dblsize_Invers)
|
TEST(Lcd, Prec1_Dblsize_Invers)
|
||||||
{
|
{
|
||||||
lcd_clear();
|
lcdClear();
|
||||||
lcd_outdezAtt(LCD_W, 10, 51, PREC1|DBLSIZE|INVERS);
|
lcd_outdezAtt(LCD_W, 10, 51, PREC1|DBLSIZE|INVERS);
|
||||||
EXPECT_TRUE(checkScreenshot("prec1_dblsize_invers"));
|
EXPECT_TRUE(checkScreenshot("prec1_dblsize_invers"));
|
||||||
}
|
}
|
||||||
|
@ -169,14 +169,14 @@ TEST(Lcd, Prec1_Dblsize_Invers)
|
||||||
|
|
||||||
TEST(Lcd, Line_Wrap)
|
TEST(Lcd, Line_Wrap)
|
||||||
{
|
{
|
||||||
lcd_clear();
|
lcdClear();
|
||||||
lcd_puts(LCD_W-10, 0, "TEST");
|
lcd_puts(LCD_W-10, 0, "TEST");
|
||||||
EXPECT_TRUE(checkScreenshot("line_wrap"));
|
EXPECT_TRUE(checkScreenshot("line_wrap"));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(Lcd, DblsizeBottomRight)
|
TEST(Lcd, DblsizeBottomRight)
|
||||||
{
|
{
|
||||||
lcd_clear();
|
lcdClear();
|
||||||
lcd_putsAtt(LCD_W-20, LCD_H-16, "TEST", DBLSIZE);
|
lcd_putsAtt(LCD_W-20, LCD_H-16, "TEST", DBLSIZE);
|
||||||
EXPECT_TRUE(checkScreenshot("dblsize_bottom_right"));
|
EXPECT_TRUE(checkScreenshot("dblsize_bottom_right"));
|
||||||
}
|
}
|
||||||
|
@ -184,7 +184,7 @@ TEST(Lcd, DblsizeBottomRight)
|
||||||
#if defined(CPUARM)
|
#if defined(CPUARM)
|
||||||
TEST(Lcd, Smlsize_putsStrIdx)
|
TEST(Lcd, Smlsize_putsStrIdx)
|
||||||
{
|
{
|
||||||
lcd_clear();
|
lcdClear();
|
||||||
putsStrIdx(0, 0, "FM", 0, SMLSIZE);
|
putsStrIdx(0, 0, "FM", 0, SMLSIZE);
|
||||||
EXPECT_TRUE(checkScreenshot("smlsize_putsstridx"));
|
EXPECT_TRUE(checkScreenshot("smlsize_putsstridx"));
|
||||||
}
|
}
|
||||||
|
@ -192,7 +192,7 @@ TEST(Lcd, Smlsize_putsStrIdx)
|
||||||
|
|
||||||
TEST(Lcd, vline)
|
TEST(Lcd, vline)
|
||||||
{
|
{
|
||||||
lcd_clear();
|
lcdClear();
|
||||||
for (int x=0; x<100; x+=2) {
|
for (int x=0; x<100; x+=2) {
|
||||||
lcd_vline(x, x/2, 12);
|
lcd_vline(x, x/2, 12);
|
||||||
}
|
}
|
||||||
|
@ -202,7 +202,7 @@ TEST(Lcd, vline)
|
||||||
#if defined(CPUARM)
|
#if defined(CPUARM)
|
||||||
TEST(Lcd, vline_x_lt0)
|
TEST(Lcd, vline_x_lt0)
|
||||||
{
|
{
|
||||||
lcd_clear();
|
lcdClear();
|
||||||
lcd_vline(50, -10, 12);
|
lcd_vline(50, -10, 12);
|
||||||
lcd_vline(100, -10, 1);
|
lcd_vline(100, -10, 1);
|
||||||
EXPECT_TRUE(checkScreenshot("vline_lt0"));
|
EXPECT_TRUE(checkScreenshot("vline_lt0"));
|
||||||
|
@ -212,7 +212,7 @@ TEST(Lcd, vline_x_lt0)
|
||||||
#if defined(CPUARM)
|
#if defined(CPUARM)
|
||||||
TEST(Lcd, Smlsize)
|
TEST(Lcd, Smlsize)
|
||||||
{
|
{
|
||||||
lcd_clear();
|
lcdClear();
|
||||||
lcd_putsAtt(0, 0, "TESTgy,", SMLSIZE);
|
lcd_putsAtt(0, 0, "TESTgy,", SMLSIZE);
|
||||||
lcd_putsAtt(10, 22, "TESTgy,", SMLSIZE|INVERS);
|
lcd_putsAtt(10, 22, "TESTgy,", SMLSIZE|INVERS);
|
||||||
drawFilledRect(8, 40, 100, 20);
|
drawFilledRect(8, 40, 100, 20);
|
||||||
|
@ -229,7 +229,7 @@ TEST(Lcd, Smlsize)
|
||||||
|
|
||||||
TEST(Lcd, Stdsize)
|
TEST(Lcd, Stdsize)
|
||||||
{
|
{
|
||||||
lcd_clear();
|
lcdClear();
|
||||||
lcd_putsAtt(0, 0, "TEST", 0);
|
lcd_putsAtt(0, 0, "TEST", 0);
|
||||||
lcd_putsAtt(10, 22, "TEST", INVERS);
|
lcd_putsAtt(10, 22, "TEST", INVERS);
|
||||||
drawFilledRect(8, 40, 100, 20);
|
drawFilledRect(8, 40, 100, 20);
|
||||||
|
@ -246,7 +246,7 @@ TEST(Lcd, Stdsize)
|
||||||
|
|
||||||
TEST(Lcd, Midsize)
|
TEST(Lcd, Midsize)
|
||||||
{
|
{
|
||||||
lcd_clear();
|
lcdClear();
|
||||||
lcd_putsAtt(0, 0, "TEST", MIDSIZE);
|
lcd_putsAtt(0, 0, "TEST", MIDSIZE);
|
||||||
lcd_putsAtt(10, 22, "TEST", MIDSIZE|INVERS);
|
lcd_putsAtt(10, 22, "TEST", MIDSIZE|INVERS);
|
||||||
drawFilledRect(8, 40, 100, 20);
|
drawFilledRect(8, 40, 100, 20);
|
||||||
|
@ -263,7 +263,7 @@ TEST(Lcd, Midsize)
|
||||||
|
|
||||||
TEST(Lcd, Dblsize)
|
TEST(Lcd, Dblsize)
|
||||||
{
|
{
|
||||||
lcd_clear();
|
lcdClear();
|
||||||
lcd_putsAtt(2, 10, "TST", DBLSIZE);
|
lcd_putsAtt(2, 10, "TST", DBLSIZE);
|
||||||
lcd_putsAtt(42, 10, "TST", DBLSIZE|INVERS);
|
lcd_putsAtt(42, 10, "TST", DBLSIZE|INVERS);
|
||||||
drawFilledRect(80, 8, 46, 24);
|
drawFilledRect(80, 8, 46, 24);
|
||||||
|
@ -282,7 +282,7 @@ TEST(Lcd, Dblsize)
|
||||||
#if defined(PCBTARANIS)
|
#if defined(PCBTARANIS)
|
||||||
TEST(Lcd, DrawSwitch)
|
TEST(Lcd, DrawSwitch)
|
||||||
{
|
{
|
||||||
lcd_clear();
|
lcdClear();
|
||||||
putsSwitches(0, 10, SWSRC_SA0, 0);
|
putsSwitches(0, 10, SWSRC_SA0, 0);
|
||||||
putsSwitches(30, 10, SWSRC_SA0, SMLSIZE);
|
putsSwitches(30, 10, SWSRC_SA0, SMLSIZE);
|
||||||
// putsSwitches(60, 10, SWSRC_SA0, MIDSIZE); missing arrows in this font
|
// putsSwitches(60, 10, SWSRC_SA0, MIDSIZE); missing arrows in this font
|
||||||
|
@ -294,7 +294,7 @@ TEST(Lcd, DrawSwitch)
|
||||||
#if defined(PCBTARANIS)
|
#if defined(PCBTARANIS)
|
||||||
TEST(Lcd, BMPWrapping)
|
TEST(Lcd, BMPWrapping)
|
||||||
{
|
{
|
||||||
lcd_clear();
|
lcdClear();
|
||||||
uint8_t bitmap[2+40*40/2];
|
uint8_t bitmap[2+40*40/2];
|
||||||
bmpLoad(bitmap, "./tests/plane.bmp", 40, 40);
|
bmpLoad(bitmap, "./tests/plane.bmp", 40, 40);
|
||||||
lcd_bmp(200, 0, bitmap);
|
lcd_bmp(200, 0, bitmap);
|
||||||
|
@ -308,7 +308,7 @@ TEST(Lcd, BMPWrapping)
|
||||||
#if defined(PCBTARANIS)
|
#if defined(PCBTARANIS)
|
||||||
TEST(Lcd, lcdDrawHorizontalLine)
|
TEST(Lcd, lcdDrawHorizontalLine)
|
||||||
{
|
{
|
||||||
lcd_clear();
|
lcdClear();
|
||||||
lcdDrawHorizontalLine(0, 10, LCD_W, DOTTED);
|
lcdDrawHorizontalLine(0, 10, LCD_W, DOTTED);
|
||||||
lcdDrawHorizontalLine(0, 20, LCD_W, SOLID);
|
lcdDrawHorizontalLine(0, 20, LCD_W, SOLID);
|
||||||
lcdDrawHorizontalLine(50, 30, LCD_W, 0xEE); //too wide
|
lcdDrawHorizontalLine(50, 30, LCD_W, 0xEE); //too wide
|
||||||
|
@ -321,7 +321,7 @@ TEST(Lcd, lcdDrawHorizontalLine)
|
||||||
#if defined(PCBTARANIS)
|
#if defined(PCBTARANIS)
|
||||||
TEST(Lcd, lcdDrawVerticalLine)
|
TEST(Lcd, lcdDrawVerticalLine)
|
||||||
{
|
{
|
||||||
lcd_clear();
|
lcdClear();
|
||||||
lcdDrawVerticalLine(10, 0, LCD_H, DOTTED);
|
lcdDrawVerticalLine(10, 0, LCD_H, DOTTED);
|
||||||
lcdDrawVerticalLine(20, 0, LCD_H, SOLID);
|
lcdDrawVerticalLine(20, 0, LCD_H, SOLID);
|
||||||
lcdDrawVerticalLine(30, 30, LCD_H, 0xEE); //too high
|
lcdDrawVerticalLine(30, 30, LCD_H, 0xEE); //too high
|
||||||
|
@ -361,7 +361,7 @@ public:
|
||||||
#if defined(PCBTARANIS)
|
#if defined(PCBTARANIS)
|
||||||
TEST(Lcd, lcd_bmpLoadAndDisplay)
|
TEST(Lcd, lcd_bmpLoadAndDisplay)
|
||||||
{
|
{
|
||||||
lcd_clear();
|
lcdClear();
|
||||||
// Test proper BMP files, they should display correctly
|
// Test proper BMP files, they should display correctly
|
||||||
{
|
{
|
||||||
TestBuffer<1000> bitmap(BITMAP_BUFFER_SIZE(7, 32));
|
TestBuffer<1000> bitmap(BITMAP_BUFFER_SIZE(7, 32));
|
||||||
|
@ -415,7 +415,7 @@ TEST(Lcd, lcdDrawLine)
|
||||||
int start, length, xOffset;
|
int start, length, xOffset;
|
||||||
uint8_t pattern;
|
uint8_t pattern;
|
||||||
|
|
||||||
lcd_clear();
|
lcdClear();
|
||||||
|
|
||||||
start = 5;
|
start = 5;
|
||||||
pattern = SOLID;
|
pattern = SOLID;
|
||||||
|
|
|
@ -1,234 +0,0 @@
|
||||||
#!/usr/bin/env python
|
|
||||||
|
|
||||||
import os, sys, shutil, platform, getpass, subprocess, zipfile, ftplib, httplib, threading
|
|
||||||
|
|
||||||
BINARY_DIR = "../build/"
|
|
||||||
|
|
||||||
options_stock = [[("", "EXT=STD"), ("frsky", "EXT=FRSKY"), ("jeti", "EXT=JETI"), ("ardupilot", "EXT=ARDUPILOT"), ("nmea", "EXT=NMEA")],
|
|
||||||
[("", "HELI=NO"), ("heli", "HELI=YES")],
|
|
||||||
[("", "TEMPLATES=NO"), ("templates", "TEMPLATES=YES")],
|
|
||||||
[("", ""), ("nosplash", "SPLASH=NO")],
|
|
||||||
[("", ""), ("nofp", "FLIGHT_PHASES=NO")],
|
|
||||||
[("", "AUDIO=NO"), ("audio", "AUDIO=YES")],
|
|
||||||
[("", "HAPTIC=NO"), ("haptic", "HAPTIC=YES")],
|
|
||||||
[("", "PXX=NO"), ("PXX", "PXX=YES")],
|
|
||||||
[("", "DSM2=NO"), ("DSM2", "DSM2=PPM")],
|
|
||||||
[("", ""), ("ppmca", "PPM_CENTER_ADJUSTABLE=YES")],
|
|
||||||
[("", "NAVIGATION=NO"), ("potscroll", "NAVIGATION=POTS")],
|
|
||||||
[("", ""), ("autoswitch", "AUTOSWITCH=YES")],
|
|
||||||
[("", ""), ("pgbar", "EEPROM_PROGRESS_BAR=YES")],
|
|
||||||
[("", "UNITS=METRIC"), ("imperial", "UNITS=IMPERIAL")],
|
|
||||||
]
|
|
||||||
|
|
||||||
options_v4 = [[("", "EXT=FRSKY")],
|
|
||||||
[("", "HELI=NO"), ("heli", "HELI=YES")],
|
|
||||||
[("", "TEMPLATES=NO"), ("templates", "TEMPLATES=YES")],
|
|
||||||
[("", ""), ("nofp", "FLIGHT_PHASES=NO")],
|
|
||||||
[("", "SDCARD=NO"), ("sdcard", "SDCARD=YES")],
|
|
||||||
[("", "SOMO=NO"), ("SOMO", "SOMO=YES")],
|
|
||||||
[("", ""), ("ppmca", "PPM_CENTER_ADJUSTABLE=YES")],
|
|
||||||
[("", ""), ("autoswitch", "AUTOSWITCH=YES")],
|
|
||||||
[("", ""), ("pgbar", "EEPROM_PROGRESS_BAR=YES")],
|
|
||||||
[("", "UNITS=METRIC"), ("imperial", "UNITS=IMPERIAL")],
|
|
||||||
]
|
|
||||||
|
|
||||||
options_arm = [[("", "EXT=FRSKY")],
|
|
||||||
[("", "HELI=NO"), ("heli", "HELI=YES")],
|
|
||||||
[("", "TEMPLATES=NO"), ("templates", "TEMPLATES=YES")],
|
|
||||||
[("", ""), ("nofp", "FLIGHT_PHASES=NO")],
|
|
||||||
[("", ""), ("autoswitch", "AUTOSWITCH=YES")],
|
|
||||||
[("", "UNITS=METRIC"), ("imperial", "UNITS=IMPERIAL")],
|
|
||||||
]
|
|
||||||
|
|
||||||
languages = ["en", "fr", "se"]
|
|
||||||
|
|
||||||
#ftp_host = "ftpperso.free.fr"
|
|
||||||
#ftp_user = "open9x"
|
|
||||||
ftp_host = "open9x.freehosting.com"
|
|
||||||
ftp_user = "openxfre"
|
|
||||||
ftp_directory = "public_html/binaries/"
|
|
||||||
|
|
||||||
def upload(binaries, ext, stamp):
|
|
||||||
if not ftp:
|
|
||||||
return
|
|
||||||
|
|
||||||
print "Zip creation..."
|
|
||||||
zip_name = "release.zip"
|
|
||||||
zip = zipfile.ZipFile(zip_name, "w", zipfile.ZIP_DEFLATED)
|
|
||||||
for bin in binaries:
|
|
||||||
zip.write(BINARY_DIR + bin + "." + ext, bin + "." + ext)
|
|
||||||
zip.write(BINARY_DIR + stamp, stamp)
|
|
||||||
zip.close()
|
|
||||||
|
|
||||||
print "FTP transfer..."
|
|
||||||
ftp_connection = ftplib.FTP(ftp_host, ftp_user, ftp_password)
|
|
||||||
try:
|
|
||||||
ftp_connection.delete(ftp_directory + zip_name)
|
|
||||||
except:
|
|
||||||
pass
|
|
||||||
f = open(zip_name, 'rb')
|
|
||||||
ftp_connection.storbinary('STOR ' + ftp_directory + zip_name, f)
|
|
||||||
f.close()
|
|
||||||
ftp_connection.quit()
|
|
||||||
|
|
||||||
print "ZIP extraction...",
|
|
||||||
http_connection = httplib.HTTPConnection("open9x.freehosting.com")
|
|
||||||
http_connection.request("GET", "/binaries/uncompress.php")
|
|
||||||
response = http_connection.getresponse()
|
|
||||||
print response.status, response.reason
|
|
||||||
os.remove(zip_name)
|
|
||||||
|
|
||||||
global_current = 0
|
|
||||||
global_count = 0
|
|
||||||
def generate(hex, arg, extension, options, languages, maxsize):
|
|
||||||
global global_current
|
|
||||||
global global_count
|
|
||||||
|
|
||||||
result = []
|
|
||||||
states = [0] * len(options)
|
|
||||||
|
|
||||||
count = len(languages)
|
|
||||||
for option in options:
|
|
||||||
count *= len(option)
|
|
||||||
global_count += count
|
|
||||||
|
|
||||||
while 1:
|
|
||||||
# print index, states
|
|
||||||
|
|
||||||
for language in languages:
|
|
||||||
hex_file = hex
|
|
||||||
make_args = ["make", arg]
|
|
||||||
for i, option in enumerate(options):
|
|
||||||
state = states[len(options) - 1 - i]
|
|
||||||
if option[state][0]:
|
|
||||||
hex_file += "-" + option[state][0]
|
|
||||||
make_args.append(option[state][1])
|
|
||||||
hex_file += "-" + language
|
|
||||||
make_args.append("TRANSLATIONS=" + language.upper())
|
|
||||||
if mt:
|
|
||||||
cwd = language
|
|
||||||
else:
|
|
||||||
cwd = "."
|
|
||||||
|
|
||||||
size = 0
|
|
||||||
if compile:
|
|
||||||
subprocess.Popen(["make", "clean", arg], stdout=subprocess.PIPE, stderr=subprocess.PIPE, cwd=cwd).wait()
|
|
||||||
p = subprocess.Popen(make_args, stdout=subprocess.PIPE, stderr=subprocess.PIPE, cwd=cwd)
|
|
||||||
ret = p.wait()
|
|
||||||
stderr = p.stderr.read()
|
|
||||||
global_current += 1
|
|
||||||
print "[%d/%d]" % (global_current, global_count), hex_file
|
|
||||||
if ret or "error" in stderr:
|
|
||||||
print stderr
|
|
||||||
exit()
|
|
||||||
for line in stderr.split("\n"):
|
|
||||||
if "warning" in line:
|
|
||||||
print " ", line
|
|
||||||
for line in p.stdout.readlines():
|
|
||||||
if line.startswith("Program:"):
|
|
||||||
parts = line.split(" ")
|
|
||||||
while "" in parts:
|
|
||||||
parts.remove("")
|
|
||||||
size = int(parts[1])
|
|
||||||
if size > maxsize:
|
|
||||||
print " ", line[:-1], "[NOT RELEASED]"
|
|
||||||
else:
|
|
||||||
print " ", line,
|
|
||||||
if line.startswith("Data:"):
|
|
||||||
print " ", line,
|
|
||||||
|
|
||||||
if size <= maxsize:
|
|
||||||
binary_name = hex_file + "." + extension
|
|
||||||
if compile:
|
|
||||||
shutil.copyfile(cwd + "/open9x." + extension, BINARY_DIR + binary_name)
|
|
||||||
result.append(hex_file)
|
|
||||||
|
|
||||||
for index, state in enumerate(states):
|
|
||||||
if state < len(options[len(options) - 1 - index]) - 1:
|
|
||||||
for i in range(index):
|
|
||||||
states[i] = 0
|
|
||||||
states[index] += 1
|
|
||||||
break
|
|
||||||
else:
|
|
||||||
break
|
|
||||||
|
|
||||||
# stamp
|
|
||||||
stamp = "stamp-open9x-%s.txt" % hex.split("-")[1]
|
|
||||||
subprocess.Popen(["make", hex.split("-")[1] + "-stamp"], stdout=subprocess.PIPE, stderr=subprocess.PIPE, cwd="../src").wait()
|
|
||||||
shutil.copyfile("../src/" + stamp, BINARY_DIR + stamp)
|
|
||||||
|
|
||||||
return result, stamp
|
|
||||||
|
|
||||||
class GenerateThread(threading.Thread):
|
|
||||||
def __init__ (self, hex, arg, extension, options, language, maxsize):
|
|
||||||
threading.Thread.__init__(self)
|
|
||||||
self.hex = hex
|
|
||||||
self.arg = arg
|
|
||||||
self.extension = extension
|
|
||||||
self.options = options
|
|
||||||
self.language = language
|
|
||||||
self.maxsize = maxsize
|
|
||||||
|
|
||||||
def run(self):
|
|
||||||
self.hexes, self.stamp = generate(self.hex, self.arg, self.extension, self.options, [self.language], self.maxsize)
|
|
||||||
|
|
||||||
def multithread_generate(hex, arg, extension, options, languages, maxsize):
|
|
||||||
if mt:
|
|
||||||
result = []
|
|
||||||
threads = []
|
|
||||||
for language in languages:
|
|
||||||
thread = GenerateThread(hex, arg, extension, options, language, maxsize)
|
|
||||||
threads.append(thread)
|
|
||||||
thread.start()
|
|
||||||
for thread in threads:
|
|
||||||
thread.join()
|
|
||||||
result.extend(thread.hexes)
|
|
||||||
stamp = thread.stamp
|
|
||||||
return result, stamp
|
|
||||||
else:
|
|
||||||
return generate(hex, arg, extension, options, languages, maxsize)
|
|
||||||
|
|
||||||
|
|
||||||
def generate_c9x_list(filename, hexes, board):
|
|
||||||
f = open(filename, "w")
|
|
||||||
f.write("const char *open9x_%s_binaries[] = {\n" % board)
|
|
||||||
for hex in hexes:
|
|
||||||
f.write('"%s",\n' % hex)
|
|
||||||
f.write("0\n};\n")
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
|
|
||||||
ftp = "ftp" in sys.argv
|
|
||||||
mt = "mt" in sys.argv and platform.system() != "Windows"
|
|
||||||
compile = not "nc" in sys.argv
|
|
||||||
|
|
||||||
if ftp:
|
|
||||||
ftp_password = getpass.getpass()
|
|
||||||
|
|
||||||
if mt:
|
|
||||||
shutil.rmtree("util", True)
|
|
||||||
shutil.copytree("../util", "util")
|
|
||||||
for lang in languages:
|
|
||||||
print "Directory %s creation..." % lang
|
|
||||||
shutil.rmtree(lang, True)
|
|
||||||
shutil.copytree("../src", lang)
|
|
||||||
|
|
||||||
if platform.system() == "Windows":
|
|
||||||
# arm board
|
|
||||||
hexes, stamp = generate("open9x-arm", "PCB=ARM", "bin", options_arm, languages, 262000)
|
|
||||||
generate_c9x_list("../../companion9x/src/open9x-arm-binaries.cpp", hexes, "arm")
|
|
||||||
upload(hexes, "bin", stamp)
|
|
||||||
|
|
||||||
else:
|
|
||||||
# stock board
|
|
||||||
if not "v4" in sys.argv:
|
|
||||||
hexes, stamp = multithread_generate("open9x-stock", "PCB=STD", "hex", options_stock, languages, 65530)
|
|
||||||
generate_c9x_list("../../companion9x/src/open9x-stock-binaries.cpp", hexes, "stock")
|
|
||||||
upload(hexes, "hex", stamp)
|
|
||||||
|
|
||||||
# v4 board
|
|
||||||
if not "stock" in sys.argv:
|
|
||||||
hexes, stamp = multithread_generate("open9x-v4", "PCB=V4", "hex", options_v4, languages, 262000)
|
|
||||||
generate_c9x_list("../../companion9x/src/open9x-v4-binaries.cpp", hexes, "v4")
|
|
||||||
upload(hexes, "hex", stamp)
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue