void menuStatisticsDebug(uint8_t event) { TITLE(STR_MENUDEBUG); #if defined(WATCHDOG_TEST) if (warningResult) { warningResult = 0; // do a user requested watchdog test TRACE("Performing watchdog test"); pausePulses(); } #endif switch(event) { case EVT_KEY_LONG(KEY_ENTER): g_eeGeneral.mAhUsed = 0; g_eeGeneral.globalTimer = 0; eeDirty(EE_GENERAL); sessionTimer = 0; killEvents(event); AUDIO_KEYPAD_UP(); break; case EVT_KEY_FIRST(KEY_ENTER): #if defined(LUA) maxLuaInterval = 0; maxLuaDuration = 0; #endif maxMixerDuration = 0; AUDIO_KEYPAD_UP(); break; #if defined(DEBUG_TRACE_BUFFER) case EVT_KEY_FIRST(KEY_UP): pushMenu(menuTraceBuffer); return; #endif case EVT_KEY_FIRST(KEY_DOWN): chainMenu(menuStatisticsView); break; case EVT_KEY_FIRST(KEY_EXIT): chainMenu(menuMainView); break; #if defined(WATCHDOG_TEST) case EVT_KEY_LONG(KEY_MENU): { POPUP_CONFIRMATION("Test the watchdog?"); const char * w = "The radio will reset!"; SET_WARNING_INFO(w, strlen(w), 0); } break; #endif } lcd_putsLeft(MENU_DEBUG_Y_FREE_RAM, "Free Mem"); lcd_outdezAtt(MENU_DEBUG_COL1_OFS, MENU_DEBUG_Y_FREE_RAM, availableMemory(), LEFT); lcd_puts(lcdLastPos, MENU_DEBUG_Y_FREE_RAM, "b"); #if defined(LUA) lcd_putsLeft(MENU_DEBUG_Y_LUA, "Lua scripts"); lcd_putsAtt(MENU_DEBUG_COL1_OFS, MENU_DEBUG_Y_LUA+1, "[Duration]", SMLSIZE); lcd_outdezAtt(lcdLastPos, MENU_DEBUG_Y_LUA, 10*maxLuaDuration, LEFT); lcd_putsAtt(lcdLastPos+2, MENU_DEBUG_Y_LUA+1, "[Interval]", SMLSIZE); lcd_outdezAtt(lcdLastPos, MENU_DEBUG_Y_LUA, 10*maxLuaInterval, LEFT); #endif lcd_putsLeft(MENU_DEBUG_Y_MIXMAX, STR_TMIXMAXMS); lcd_outdezAtt(MENU_DEBUG_COL1_OFS, MENU_DEBUG_Y_MIXMAX, DURATION_MS_PREC2(maxMixerDuration), PREC2|LEFT); lcd_puts(lcdLastPos, MENU_DEBUG_Y_MIXMAX, "ms"); #if defined(USB_SERIAL) lcd_putsLeft(MENU_DEBUG_Y_USB, "Usb"); lcd_outdezAtt(MENU_DEBUG_COL1_OFS, MENU_DEBUG_Y_USB, charsWritten, LEFT); lcd_puts(lcdLastPos, MENU_DEBUG_Y_USB, " "); lcd_outdezAtt(lcdLastPos, MENU_DEBUG_Y_USB, APP_Rx_ptr_in, LEFT); lcd_puts(lcdLastPos, MENU_DEBUG_Y_USB, " "); lcd_outdezAtt(lcdLastPos, MENU_DEBUG_Y_USB, usbWraps, LEFT); #endif lcd_putsLeft(MENU_DEBUG_Y_RTOS, STR_FREESTACKMINB); lcd_putsAtt(MENU_DEBUG_COL1_OFS, MENU_DEBUG_Y_RTOS+1, "[M]", SMLSIZE); lcd_outdezAtt(lcdLastPos, MENU_DEBUG_Y_RTOS, menusStack.available(), UNSIGN|LEFT); lcd_putsAtt(lcdLastPos+2, MENU_DEBUG_Y_RTOS+1, "[X]", SMLSIZE); lcd_outdezAtt(lcdLastPos, MENU_DEBUG_Y_RTOS, mixerStack.available(), UNSIGN|LEFT); lcd_putsAtt(lcdLastPos+2, MENU_DEBUG_Y_RTOS+1, "[A]", SMLSIZE); lcd_outdezAtt(lcdLastPos, MENU_DEBUG_Y_RTOS, audioStack.available(), UNSIGN|LEFT); lcd_putsAtt(lcdLastPos+2, MENU_DEBUG_Y_RTOS+1, "[I]", SMLSIZE); lcd_outdezAtt(lcdLastPos, MENU_DEBUG_Y_RTOS, stackAvailable(), UNSIGN|LEFT); lcd_puts(3*FW, 7*FH+1, STR_MENUTORESET); lcd_status_line(); }
void menuStatisticsDebug(uint8_t event) { TITLE(STR_MENUDEBUG); switch(event) { case EVT_KEY_LONG(KEY_ENTER): g_eeGeneral.mAhUsed = 0; g_eeGeneral.globalTimer = 0; eeDirty(EE_GENERAL); sessionTimer = 0; killEvents(event); AUDIO_KEYPAD_UP(); break; case EVT_KEY_FIRST(KEY_ENTER): #if defined(LUA) maxLuaInterval = 0; maxLuaDuration = 0; #endif maxMixerDuration = 0; AUDIO_KEYPAD_UP(); break; #if defined(DEBUG_TRACE_BUFFER) case EVT_KEY_FIRST(KEY_UP): pushMenu(menuTraceBuffer); return; #endif case EVT_KEY_FIRST(KEY_DOWN): chainMenu(menuStatisticsView); break; case EVT_KEY_FIRST(KEY_EXIT): chainMenu(menuMainView); break; } lcd_putsLeft(MENU_DEBUG_Y_FREE_RAM, "Free Mem"); lcd_outdezAtt(MENU_DEBUG_COL1_OFS, MENU_DEBUG_Y_FREE_RAM, getAvailableMemory(), LEFT); lcd_puts(lcdLastPos, MENU_DEBUG_Y_FREE_RAM, "b"); #if defined(LUA) lcd_putsLeft(MENU_DEBUG_Y_LUA, "Lua scripts"); lcd_putsAtt(MENU_DEBUG_COL1_OFS, MENU_DEBUG_Y_LUA+1, "[Duration]", SMLSIZE); lcd_outdezAtt(lcdLastPos, MENU_DEBUG_Y_LUA, 10*maxLuaDuration, LEFT); lcd_putsAtt(lcdLastPos+2, MENU_DEBUG_Y_LUA+1, "[Interval]", SMLSIZE); lcd_outdezAtt(lcdLastPos, MENU_DEBUG_Y_LUA, 10*maxLuaInterval, LEFT); #endif lcd_putsLeft(MENU_DEBUG_Y_MIXMAX, STR_TMIXMAXMS); lcd_outdezAtt(MENU_DEBUG_COL1_OFS, MENU_DEBUG_Y_MIXMAX, DURATION_MS_PREC2(maxMixerDuration), PREC2|LEFT); lcd_puts(lcdLastPos, MENU_DEBUG_Y_MIXMAX, "ms"); lcd_putsLeft(MENU_DEBUG_Y_RTOS, STR_FREESTACKMINB); lcd_putsAtt(MENU_DEBUG_COL1_OFS, MENU_DEBUG_Y_RTOS+1, "[M]", SMLSIZE); lcd_outdezAtt(lcdLastPos, MENU_DEBUG_Y_RTOS, stack_free(0), UNSIGN|LEFT); lcd_putsAtt(lcdLastPos+2, MENU_DEBUG_Y_RTOS+1, "[X]", SMLSIZE); lcd_outdezAtt(lcdLastPos, MENU_DEBUG_Y_RTOS, stack_free(1), UNSIGN|LEFT); lcd_putsAtt(lcdLastPos+2, MENU_DEBUG_Y_RTOS+1, "[A]", SMLSIZE); lcd_outdezAtt(lcdLastPos, MENU_DEBUG_Y_RTOS, stack_free(2), UNSIGN|LEFT); lcd_putsAtt(lcdLastPos+2, MENU_DEBUG_Y_RTOS+1, "[I]", SMLSIZE); lcd_outdezAtt(lcdLastPos, MENU_DEBUG_Y_RTOS, stack_free(255), UNSIGN|LEFT); lcd_puts(3*FW, 7*FH+1, STR_MENUTORESET); lcd_status_line(); }
void menuStatisticsDebug(uint8_t event) { TITLE(STR_MENUDEBUG); switch(event) { #if defined(CPUARM) case EVT_KEY_LONG(KEY_ENTER): g_eeGeneral.mAhUsed = 0; g_eeGeneral.globalTimer = 0; eeDirty(EE_GENERAL); #if defined(PCBSKY9X) Current_used = 0; #endif sessionTimer = 0; killEvents(event); AUDIO_KEYPAD_UP(); break; #endif case EVT_KEY_FIRST(KEY_ENTER): #if !defined(CPUARM) g_tmr1Latency_min = 0xff; g_tmr1Latency_max = 0; #endif #if defined(LUA) maxLuaInterval = 0; maxLuaDuration = 0; #endif maxMixerDuration = 0; AUDIO_KEYPAD_UP(); break; case EVT_KEY_FIRST(KEY_DOWN): chainMenu(menuStatisticsView); return; case EVT_KEY_FIRST(KEY_EXIT): chainMenu(menuMainView); return; } #if defined(PCBSKY9X) if ((ResetReason&RSTC_SR_RSTTYP) == (2<<8)) { lcd_puts(LCD_W-8*FW, 0*FH, "WATCHDOG"); } else if (unexpectedShutdown) { lcd_puts(LCD_W-13*FW, 0*FH, "UNEXP.SHTDOWN"); } #endif #if defined(PCBSKY9X) && !defined(REVA) // current lcd_putsLeft(1*FH, STR_CPU_CURRENT); putsTelemetryValue(MENU_DEBUG_COL1_OFS, 1*FH, getCurrent(), UNIT_MILLIAMPS, LEFT); uint32_t current_scale = 488 + g_eeGeneral.currentCalib; lcd_putc(MENU_DEBUG_COL2_OFS, 1*FH, '>'); putsTelemetryValue(MENU_DEBUG_COL2_OFS+FW+1, 1*FH, Current_max*10*current_scale/8192, UNIT_RAW, LEFT); // consumption lcd_putsLeft(2*FH, STR_CPU_MAH); putsTelemetryValue(MENU_DEBUG_COL1_OFS, 2*FH, g_eeGeneral.mAhUsed + Current_used*current_scale/8192/36, UNIT_MAH, LEFT|PREC1); putsTimer(MENU_DEBUG_COL2_OFS, 2*FH, g_eeGeneral.globalTimer + sessionTimer, LEFT, 0); #endif #if defined(PCBSKY9X) lcd_putsLeft(3*FH, STR_CPU_TEMP); putsTelemetryValue(MENU_DEBUG_COL1_OFS, 3*FH, getTemperature(), UNIT_TEMPERATURE, LEFT); lcd_putc(MENU_DEBUG_COL2_OFS, 3*FH, '>'); putsTelemetryValue(MENU_DEBUG_COL2_OFS+FW+1, 3*FH, maxTemperature+g_eeGeneral.temperatureCalib, UNIT_TEMPERATURE, LEFT); #endif #if defined(COPROCESSOR) lcd_putsLeft(4*FH, STR_COPROC_TEMP); if (Coproc_read==0) { lcd_putsAtt(MENU_DEBUG_COL1_OFS, 4*FH, PSTR("Co Proc NACK"),INVERS); } else if (Coproc_read==0x81) { lcd_putsAtt(MENU_DEBUG_COL1_OFS, 4*FH, PSTR("Inst.TinyApp"),INVERS); } else if (Coproc_read<3) { lcd_putsAtt(MENU_DEBUG_COL1_OFS, 4*FH, PSTR("Upgr.TinyApp"),INVERS); } else { putsTelemetryValue(MENU_DEBUG_COL1_OFS, 4*FH, Coproc_temp, UNIT_TEMPERATURE, LEFT); putsTelemetryValue(MENU_DEBUG_COL2_OFS, 4*FH, Coproc_maxtemp, UNIT_TEMPERATURE, LEFT); } #endif #if defined(PCBTARANIS) && !defined(SIMU) lcd_putsLeft(3*FH, "Free Mem"); lcd_outdezAtt(MENU_DEBUG_COL1_OFS, 3*FH, 0x20020000 - (unsigned int)heap, LEFT); #endif #if defined(LUA) lcd_putsLeft(4*FH, "Lua scripts"); lcd_putsAtt(MENU_DEBUG_COL1_OFS-1, 4*FH+1, "[Duration]", SMLSIZE); lcd_outdezAtt(lcdLastPos, 4*FH, 10*maxLuaDuration, LEFT); lcd_putsAtt(lcdLastPos+2, 4*FH+1, "[Interval]", SMLSIZE); lcd_outdezAtt(lcdLastPos, 4*FH, 10*maxLuaInterval, LEFT); #endif #if defined(CPUARM) lcd_putsLeft(5*FH, STR_TMIXMAXMS); lcd_outdezAtt(MENU_DEBUG_COL1_OFS, 5*FH, DURATION_MS_PREC2(maxMixerDuration), PREC2|LEFT); lcd_puts(lcdLastPos, 5*FH, "ms"); lcd_putsLeft(6*FH, STR_FREESTACKMINB); #if LCD_W >= 212 lcd_putsAtt(MENU_DEBUG_COL1_OFS-1, 6*FH+1, "[Main]", SMLSIZE); lcd_outdezAtt(lcdLastPos, 6*FH, stack_free(0), UNSIGN|LEFT); lcd_putsAtt(lcdLastPos+2, 6*FH+1, "[Mix]", SMLSIZE); lcd_outdezAtt(lcdLastPos, 6*FH, stack_free(1), UNSIGN|LEFT); lcd_putsAtt(lcdLastPos+2, 6*FH+1, "[Audio]", SMLSIZE); lcd_outdezAtt(lcdLastPos, 6*FH, stack_free(2), UNSIGN|LEFT); #else lcd_outdezAtt(MENU_DEBUG_COL1_OFS, 6*FH, stack_free(0), UNSIGN|LEFT); lcd_puts(lcdLastPos, 6*FH, "/"); lcd_outdezAtt(lcdLastPos, 6*FH, stack_free(1), UNSIGN|LEFT); lcd_puts(lcdLastPos, 6*FH, "/"); lcd_outdezAtt(lcdLastPos, 6*FH, stack_free(2), UNSIGN|LEFT); #endif #else lcd_putsLeft(1*FH, STR_TMR1LATMAXUS); lcd_outdez8(MENU_DEBUG_COL1_OFS , 1*FH, g_tmr1Latency_max/2 ); lcd_putsLeft(2*FH, STR_TMR1LATMINUS); lcd_outdez8(MENU_DEBUG_COL1_OFS , 2*FH, g_tmr1Latency_min/2 ); lcd_putsLeft(3*FH, STR_TMR1JITTERUS); lcd_outdez8(MENU_DEBUG_COL1_OFS , 3*FH, (g_tmr1Latency_max - g_tmr1Latency_min) /2 ); lcd_putsLeft(4*FH, STR_TMIXMAXMS); lcd_outdezAtt(MENU_DEBUG_COL1_OFS, 4*FH, DURATION_MS_PREC2(maxMixerDuration), PREC2); lcd_putsLeft(5*FH, STR_FREESTACKMINB); lcd_outdezAtt(14*FW, 5*FH, stack_free(), UNSIGN) ; #endif lcd_puts(3*FW, 7*FH+1, STR_MENUTORESET); lcd_status_line(); }