[Horus] Choosing a model bitmap was broken
This commit is contained in:
@@ -22,6 +22,7 @@
|
|||||||
#define _MENUS_H_
|
#define _MENUS_H_
|
||||||
|
|
||||||
#include "keys.h"
|
#include "keys.h"
|
||||||
|
#include "audio.h"
|
||||||
|
|
||||||
#define MENU_COLUMN2_X 280
|
#define MENU_COLUMN2_X 280
|
||||||
#define MIXES_2ND_COLUMN 140
|
#define MIXES_2ND_COLUMN 140
|
||||||
@@ -490,16 +491,16 @@ void drawPopupBackgroundAndBorder(coord_t x, coord_t y, coord_t w, coord_t h);
|
|||||||
void showMessageBox(const char * title);
|
void showMessageBox(const char * title);
|
||||||
void runPopupWarning(event_t event);
|
void runPopupWarning(event_t event);
|
||||||
|
|
||||||
extern void (* popupFunc)(event_t event);
|
typedef void (* PopupFunc)(event_t event);
|
||||||
|
extern PopupFunc popupFunc;
|
||||||
|
|
||||||
extern uint8_t warningInfoFlags;
|
extern uint8_t warningInfoFlags;
|
||||||
|
|
||||||
#define DISPLAY_WARNING(evt) (*popupFunc)(evt)
|
inline void DISPLAY_WARNING(event_t event)
|
||||||
#define POPUP_INPUT(s, func) (warningText = s, popupFunc = func)
|
{
|
||||||
#define SET_WARNING_INFO(info, len, flags) (warningInfoText = info, warningInfoLength = len, warningInfoFlags = flags)
|
(*popupFunc)(event);
|
||||||
|
}
|
||||||
|
|
||||||
#define POPUP_MENU_ADD_ITEM(s) do { popupMenuOffsetType = MENU_OFFSET_INTERNAL; if (popupMenuItemsCount < POPUP_MENU_MAX_LINES) popupMenuItems[popupMenuItemsCount++] = s; } while (0)
|
|
||||||
#define POPUP_MENU_SELECT_ITEM(s) popupMenuSelectedItem = (s > 0 ? (s < popupMenuItemsCount ? s : popupMenuItemsCount - 1) : 0)
|
|
||||||
#define POPUP_MENU_START(func) do { popupMenuHandler = (func); AUDIO_KEY_PRESS(); } while(0)
|
|
||||||
#define POPUP_MENU_MAX_LINES 12
|
#define POPUP_MENU_MAX_LINES 12
|
||||||
#define MENU_MAX_DISPLAY_LINES 9
|
#define MENU_MAX_DISPLAY_LINES 9
|
||||||
#define MENU_LINE_LENGTH (LEN_MODEL_NAME+12)
|
#define MENU_LINE_LENGTH (LEN_MODEL_NAME+12)
|
||||||
@@ -514,7 +515,42 @@ enum {
|
|||||||
extern uint8_t popupMenuOffsetType;
|
extern uint8_t popupMenuOffsetType;
|
||||||
extern uint8_t popupMenuSelectedItem;
|
extern uint8_t popupMenuSelectedItem;
|
||||||
const char * runPopupMenu(event_t event);
|
const char * runPopupMenu(event_t event);
|
||||||
extern void (*popupMenuHandler)(const char * result);
|
|
||||||
|
typedef void (* PopupMenuHandler)(const char * result);
|
||||||
|
extern PopupMenuHandler popupMenuHandler;
|
||||||
|
|
||||||
|
inline void POPUP_INPUT(const char * s, PopupFunc func)
|
||||||
|
{
|
||||||
|
warningText = s;
|
||||||
|
warningInfoText = nullptr;
|
||||||
|
warningType = WARNING_TYPE_INPUT;
|
||||||
|
popupFunc = func;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void SET_WARNING_INFO(const char * info, uint8_t length, uint8_t flags)
|
||||||
|
{
|
||||||
|
warningInfoText = info;
|
||||||
|
warningInfoLength = length;
|
||||||
|
warningInfoFlags = flags;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void POPUP_MENU_ADD_ITEM(const char * s)
|
||||||
|
{
|
||||||
|
popupMenuOffsetType = MENU_OFFSET_INTERNAL;
|
||||||
|
if (popupMenuItemsCount < POPUP_MENU_MAX_LINES)
|
||||||
|
popupMenuItems[popupMenuItemsCount++] = s;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void POPUP_MENU_SELECT_ITEM(uint8_t index)
|
||||||
|
{
|
||||||
|
popupMenuSelectedItem = (index > 0 ? (index < popupMenuItemsCount ? index : popupMenuItemsCount - 1) : 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void POPUP_MENU_START(PopupMenuHandler handler)
|
||||||
|
{
|
||||||
|
popupMenuHandler = handler;
|
||||||
|
AUDIO_KEY_PRESS();
|
||||||
|
}
|
||||||
|
|
||||||
inline void CLEAR_POPUP()
|
inline void CLEAR_POPUP()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -20,13 +20,13 @@
|
|||||||
|
|
||||||
#include "opentx.h"
|
#include "opentx.h"
|
||||||
|
|
||||||
const char *warningText = NULL;
|
const char *warningText = nullptr;
|
||||||
const char *warningInfoText;
|
const char *warningInfoText;
|
||||||
uint8_t warningInfoLength;
|
uint8_t warningInfoLength;
|
||||||
uint8_t warningType;
|
uint8_t warningType;
|
||||||
uint8_t warningResult = 0;
|
uint8_t warningResult = 0;
|
||||||
uint8_t warningInfoFlags = ZCHAR;
|
uint8_t warningInfoFlags = ZCHAR;
|
||||||
void (*popupFunc)(event_t event) = NULL;
|
PopupFunc popupFunc = nullptr;
|
||||||
const char *popupMenuItems[POPUP_MENU_MAX_LINES];
|
const char *popupMenuItems[POPUP_MENU_MAX_LINES];
|
||||||
uint8_t popupMenuSelectedItem = 0;
|
uint8_t popupMenuSelectedItem = 0;
|
||||||
uint16_t popupMenuItemsCount = 0;
|
uint16_t popupMenuItemsCount = 0;
|
||||||
@@ -115,7 +115,7 @@ void runPopupWarning(event_t event)
|
|||||||
|
|
||||||
const char * runPopupMenu(event_t event)
|
const char * runPopupMenu(event_t event)
|
||||||
{
|
{
|
||||||
const char * result = NULL;
|
const char * result = nullptr;
|
||||||
|
|
||||||
uint8_t display_count = min<unsigned int>(popupMenuItemsCount, MENU_MAX_DISPLAY_LINES);
|
uint8_t display_count = min<unsigned int>(popupMenuItemsCount, MENU_MAX_DISPLAY_LINES);
|
||||||
|
|
||||||
|
|||||||
@@ -248,6 +248,29 @@ bool menuRadioSdManager(event_t _event)
|
|||||||
POPUP_MENU_ADD_ITEM(STR_FLASH_INTERNAL_MODULE);
|
POPUP_MENU_ADD_ITEM(STR_FLASH_INTERNAL_MODULE);
|
||||||
POPUP_MENU_ADD_ITEM(STR_FLASH_EXTERNAL_MODULE);
|
POPUP_MENU_ADD_ITEM(STR_FLASH_EXTERNAL_MODULE);
|
||||||
}
|
}
|
||||||
|
else if (!READ_ONLY() && !strcasecmp(ext, UPDATE_FIRMWARE_EXT)) {
|
||||||
|
FrSkyFirmwareInformation information;
|
||||||
|
if (readFirmwareInformation(line, information) == nullptr) {
|
||||||
|
if (information.productFamily == FIRMWARE_FAMILY_INTERNAL_MODULE)
|
||||||
|
POPUP_MENU_ADD_ITEM(STR_FLASH_INTERNAL_MODULE);
|
||||||
|
if (information.productFamily == FIRMWARE_FAMILY_EXTERNAL_MODULE)
|
||||||
|
POPUP_MENU_ADD_ITEM(STR_FLASH_EXTERNAL_MODULE);
|
||||||
|
if (HAS_SPORT_UPDATE_CONNECTOR() && (information.productFamily == FIRMWARE_FAMILY_RECEIVER || information.productFamily == FIRMWARE_FAMILY_SENSOR))
|
||||||
|
POPUP_MENU_ADD_ITEM(STR_FLASH_EXTERNAL_DEVICE);
|
||||||
|
#if defined(PXX2)
|
||||||
|
if (information.productFamily == FIRMWARE_FAMILY_RECEIVER)
|
||||||
|
POPUP_MENU_ADD_ITEM(STR_FLASH_RECEIVER_OTA);
|
||||||
|
#endif
|
||||||
|
#if defined(BLUETOOTH)
|
||||||
|
if (information.productFamily == FIRMWARE_FAMILY_BLUETOOTH_CHIP)
|
||||||
|
POPUP_MENU_ADD_ITEM(STR_FLASH_BLUETOOTH_MODULE);
|
||||||
|
#endif
|
||||||
|
#if defined(HARDWARE_POWER_MANAGEMENT_UNIT)
|
||||||
|
if (information.productFamily == FIRMWARE_FAMILY_POWER_MANAGEMENT_UNIT)
|
||||||
|
POPUP_MENU_ADD_ITEM(STR_FLASH_POWER_MANAGEMENT_UNIT);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
}
|
||||||
else if (isExtensionMatching(ext, SCRIPTS_EXT)) {
|
else if (isExtensionMatching(ext, SCRIPTS_EXT)) {
|
||||||
POPUP_MENU_ADD_ITEM(STR_EXECUTE_FILE);
|
POPUP_MENU_ADD_ITEM(STR_EXECUTE_FILE);
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-1
@@ -312,7 +312,8 @@ void guiMain(event_t evt)
|
|||||||
}
|
}
|
||||||
if (menu) {
|
if (menu) {
|
||||||
const char * result = runPopupMenu(evt);
|
const char * result = runPopupMenu(evt);
|
||||||
if (popupMenuItemsCount == 0) {
|
if (result) {
|
||||||
|
TRACE("popupMenuHandler(%s)", result);
|
||||||
popupMenuHandler(result);
|
popupMenuHandler(result);
|
||||||
if (menuEvent == 0) {
|
if (menuEvent == 0) {
|
||||||
evt = EVT_REFRESH;
|
evt = EVT_REFRESH;
|
||||||
|
|||||||
Reference in New Issue
Block a user