Refactored menu working
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
<extension point="org.eclipse.cdt.core.LanguageSettingsProvider">
|
||||
<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
|
||||
<provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuildCommandParser" id="com.crt.advproject.GCCBuildCommandParser" keep-relative-paths="false" name="MCU GCC Build Output Parser" parameter="(arm-none-eabi-gcc)|(arm-none-eabi-[gc]\+\+)|(gcc)|([gc]\+\+)|(clang)" prefer-non-shared="true"/>
|
||||
<provider class="com.crt.advproject.specs.MCUGCCBuiltinSpecsDetector" console="false" env-hash="1306207612663373935" id="com.crt.advproject.GCCBuildSpecCompilerParser" keep-relative-paths="false" name="MCU GCC Built-in Compiler Parser" parameter="${COMMAND} ${FLAGS} -E -P -v -dD "${INPUTS}"" prefer-non-shared="true">
|
||||
<provider class="com.crt.advproject.specs.MCUGCCBuiltinSpecsDetector" console="false" env-hash="1313769797021974473" id="com.crt.advproject.GCCBuildSpecCompilerParser" keep-relative-paths="false" name="MCU GCC Built-in Compiler Parser" parameter="${COMMAND} ${FLAGS} -E -P -v -dD "${INPUTS}"" prefer-non-shared="true">
|
||||
<language-scope id="org.eclipse.cdt.core.gcc"/>
|
||||
<language-scope id="org.eclipse.cdt.core.g++"/>
|
||||
</provider>
|
||||
@@ -15,7 +15,7 @@
|
||||
<extension point="org.eclipse.cdt.core.LanguageSettingsProvider">
|
||||
<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
|
||||
<provider copy-of="extension" id="com.crt.advproject.GCCBuildCommandParser"/>
|
||||
<provider class="com.crt.advproject.specs.MCUGCCBuiltinSpecsDetector" console="false" env-hash="1278677181651646161" id="com.crt.advproject.GCCBuildSpecCompilerParser" keep-relative-paths="false" name="MCU GCC Built-in Compiler Parser" parameter="${COMMAND} ${FLAGS} -E -P -v -dD "${INPUTS}"" prefer-non-shared="true">
|
||||
<provider class="com.crt.advproject.specs.MCUGCCBuiltinSpecsDetector" console="false" env-hash="1322443953297487911" id="com.crt.advproject.GCCBuildSpecCompilerParser" keep-relative-paths="false" name="MCU GCC Built-in Compiler Parser" parameter="${COMMAND} ${FLAGS} -E -P -v -dD "${INPUTS}"" prefer-non-shared="true">
|
||||
<language-scope id="org.eclipse.cdt.core.gcc"/>
|
||||
<language-scope id="org.eclipse.cdt.core.g++"/>
|
||||
</provider>
|
||||
|
||||
@@ -55,6 +55,7 @@
|
||||
#endif
|
||||
|
||||
//Menu Press Functions
|
||||
#define KEY_HOME KEY0
|
||||
#define KEY_BACK KEY1 //Cancel / Back in menu
|
||||
#define KEY_UP KEY2 //Up in menu
|
||||
#define KEY_DOWN KEY3 //Down in menu
|
||||
|
||||
@@ -255,7 +255,7 @@ uint32_t tmp;
|
||||
|
||||
KEY_Update();
|
||||
|
||||
|
||||
Tx_TimeOut(); // Check main transmitter timer
|
||||
|
||||
|
||||
#if !BYPASS_USB_SAFETY
|
||||
@@ -398,6 +398,9 @@ uint32_t tmp;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -81,6 +81,8 @@ extern uint8_t Port_State[];
|
||||
extern HARDWARE_FIX_t hwf;
|
||||
extern uint32_t systemTime;
|
||||
|
||||
MenuItem_t _menuItems[50];
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
@@ -88,7 +90,9 @@ extern uint32_t systemTime;
|
||||
******************************************************************************/
|
||||
|
||||
static Menu_t* getNewMenu(MenuHandler_t handler);
|
||||
static Menu_t* getCurrentMenu(void);
|
||||
static int handleSystemInfoMenu(Menu_t *menu);
|
||||
static int handleAutoShutdown(Menu_t *menu);
|
||||
|
||||
static void ClearMenuItems(MenuItem_t items[], uint32_t num);
|
||||
|
||||
@@ -137,6 +141,7 @@ static void createMenuItem(MenuItemId_t id, MenuItem_t *item)
|
||||
{
|
||||
item->pMonoIcon = 0;
|
||||
strcpy(item->text, "Auto Shutdown");
|
||||
item->handler = handleAutoShutdown;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -191,6 +196,11 @@ static void handleUpDown(uint32_t pressed, Menu_t *menu)
|
||||
|
||||
switch(pressed)
|
||||
{
|
||||
case KEY_HOME:
|
||||
{
|
||||
menu->exitCode = MENU_HOME;
|
||||
break;
|
||||
}
|
||||
case KEY_UP:
|
||||
{
|
||||
menu->selected--;
|
||||
@@ -244,6 +254,10 @@ static void drawScrollBar(Menu_t *menu)
|
||||
}
|
||||
|
||||
|
||||
static Menu_t* getCurrentMenu(void)
|
||||
{
|
||||
return &_menuData.menuStack[_menuData.stackCount-1];
|
||||
}
|
||||
|
||||
static Menu_t* getNewMenu(MenuHandler_t handler)
|
||||
{
|
||||
@@ -268,6 +282,17 @@ static Menu_t* getNewMenu(MenuHandler_t handler)
|
||||
return menu;
|
||||
}
|
||||
|
||||
static int handleAutoShutdown(Menu_t *menu)
|
||||
{
|
||||
// cycle through selections
|
||||
tmr_ChangeAutoSDTimer();
|
||||
|
||||
menu = getCurrentMenu();
|
||||
|
||||
menu->draw = true;
|
||||
|
||||
}
|
||||
|
||||
static int handleSystemInfoMenu(Menu_t *menu)
|
||||
{
|
||||
if (menu == NULL)
|
||||
@@ -397,7 +422,7 @@ static int handleMainMenu(Menu_t *menu)
|
||||
if (menu->items[menu->selected].handler != NULL)
|
||||
{
|
||||
menu->items[menu->selected].handler(NULL);
|
||||
return MENU_OK;
|
||||
//return MENU_OK;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1501,7 +1526,7 @@ void Menu_service(void)
|
||||
|
||||
if (_menuData.stackCount > 0)
|
||||
{
|
||||
_menuData.currentMenu = &_menuData.menuStack[_menuData.stackCount-1];
|
||||
_menuData.currentMenu = getCurrentMenu();
|
||||
_menuData.currentMenu->draw = true;
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -70,9 +70,10 @@ uint32_t systemTime = 0; // 10mS ticks
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
|
||||
#define TIMER_SCALE 10
|
||||
void ctimer_match0_callback(uint32_t flags) // ISR every 10mS
|
||||
{
|
||||
int timerScaler = 0;
|
||||
static bool Test_Flg = false;
|
||||
if(Test_Flg)
|
||||
GPIO_PinWrite(GPIO, 0, 4, 1); //TODO remove
|
||||
@@ -81,12 +82,14 @@ void ctimer_match0_callback(uint32_t flags) // ISR every 10mS
|
||||
|
||||
Test_Flg ^=1;
|
||||
|
||||
// Sys_Timer = 1000000;
|
||||
// it goes here
|
||||
systemTime++; // increment system time by 10mS
|
||||
|
||||
Check_Live_Voltage();
|
||||
|
||||
systemTime += 10; // increment system time by 10mS
|
||||
if ((systemTime % TIMER_SCALE != 0))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (Sys_Timer > 0)
|
||||
Sys_Timer--;
|
||||
@@ -111,9 +114,6 @@ void ctimer_match0_callback(uint32_t flags) // ISR every 10mS
|
||||
if(Key_Lock_Out_tmr > 0)
|
||||
Key_Lock_Out_tmr--;
|
||||
|
||||
KEY_Update();
|
||||
|
||||
Tx_TimeOut(); // Check main transmitter timer
|
||||
|
||||
if( Port_timer > 0)
|
||||
Port_timer--; // Port checking timer
|
||||
@@ -159,7 +159,7 @@ uint8_t i;
|
||||
/* Configuration 0 */
|
||||
matchConfig0.enableCounterReset = true;
|
||||
matchConfig0.enableCounterStop = false;
|
||||
matchConfig0.matchValue = 1500000;//150MHz clock 10mS period
|
||||
matchConfig0.matchValue = 150000;//150MHz clock 10mS period
|
||||
matchConfig0.enableInterrupt = true;
|
||||
|
||||
CTIMER_RegisterCallBack(CTIMER, &ctimer_callback_table[0], kCTIMER_MultipleCallback);
|
||||
@@ -210,7 +210,7 @@ void tmr_ChangeAutoSDTimer(void)
|
||||
tmr.autoShutdown = (AUTO_SHUTDOWN_t)0;
|
||||
}
|
||||
|
||||
Tx_timer = TX_TIME[i]; // reload the timer
|
||||
Tx_timer = TX_TIME[tmr.autoShutdown]; // reload the timer
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
#define TIME_7HR 7*TIME_1HR
|
||||
#define TIME_8HR 8*TIME_1HR
|
||||
#define TIME_9HR 9*TIME_1HR
|
||||
#define TIME_0HR 10
|
||||
#define TIME_0HR 100
|
||||
#define DELAY_5S 500
|
||||
#define DELAY_1S 100
|
||||
#define DELAY_2S 200
|
||||
|
||||
Reference in New Issue
Block a user