[all] Menus almost all renamed
[sky9x] Audio refactoring [sky9x] No hex compiled, it's not needed
This commit is contained in:
+1
-6
@@ -197,12 +197,7 @@ extern "C" {
|
||||
/ ff_req_grant, ff_rel_grant, ff_del_syncobj and ff_cre_syncobj
|
||||
/ function must be added to the project. */
|
||||
|
||||
// TODO needed?
|
||||
#if defined(PCBSKY9X)
|
||||
#define _FS_SHARE 4 /* 0:Disable or >=1:Enable */
|
||||
#else
|
||||
#define _FS_SHARE 2 /* 0:Disable or >=1:Enable */
|
||||
#endif
|
||||
#define _FS_SHARE 0 /* 0:Disable or >=1:Enable */
|
||||
|
||||
/* To enable file shareing feature, set _FS_SHARE to 1 or greater. The value
|
||||
defines how many files can be opened simultaneously. */
|
||||
|
||||
+1
-1
@@ -707,7 +707,7 @@ all: begin gccversion sizebefore build sizeafter end
|
||||
|
||||
# Change the build target to build a HEX file or a library.
|
||||
ifeq ($(PCB), SKY9X)
|
||||
build: stamp_header font.lbm font_dblsize.lbm sticks.lbm s9xsplash.lbm asterisk.lbm allsrc.cpp elf remallsrc bin hex lss
|
||||
build: stamp_header font.lbm font_dblsize.lbm sticks.lbm s9xsplash.lbm asterisk.lbm allsrc.cpp elf remallsrc bin lss
|
||||
else
|
||||
build: stamp_header font.lbm font_dblsize.lbm sticks.lbm s9xsplash.lbm asterisk.lbm allsrc.cpp elf remallsrc hex eep lss sym
|
||||
endif
|
||||
|
||||
+35
-35
@@ -159,14 +159,14 @@ uint8_t ibuf[NB_BUF]; // subscripts on buffers values
|
||||
char rbuf[NB_BUF][LG_BUF]; // receive buffers
|
||||
const char val_unknown[] = "?";
|
||||
|
||||
void menuProcArduPilot1(uint8_t event);
|
||||
void menuProcArduPilot2(uint8_t event);
|
||||
void menuProcArduPilot3(uint8_t event);
|
||||
void menuProcArduPilot4(uint8_t event);
|
||||
void menuProcArduPilot5(uint8_t event);
|
||||
void menuProcArduPilot6(uint8_t event);
|
||||
void menuProcArduPilot7(uint8_t event);
|
||||
void menuProcArduPilot8(uint8_t event);
|
||||
void menuTelemetryArduPilot1(uint8_t event);
|
||||
void menuTelemetryArduPilot2(uint8_t event);
|
||||
void menuTelemetryArduPilot3(uint8_t event);
|
||||
void menuTelemetryArduPilot4(uint8_t event);
|
||||
void menuTelemetryArduPilot5(uint8_t event);
|
||||
void menuTelemetryArduPilot6(uint8_t event);
|
||||
void menuTelemetryArduPilot7(uint8_t event);
|
||||
void menuTelemetryArduPilot8(uint8_t event);
|
||||
void title(char x);
|
||||
void initval(uint8_t num, uint8_t pack, uint8_t val);
|
||||
|
||||
@@ -441,26 +441,26 @@ void ARDUPILOT_EnableRXD (void)
|
||||
UCSR0B |= (1 << RXCIE0); // enable Interrupt
|
||||
}
|
||||
|
||||
void menuProcArduPilot(uint8_t event)
|
||||
void menuTelemetryArduPilot(uint8_t event)
|
||||
{
|
||||
menuProcArduPilot1(event);
|
||||
menuTelemetryArduPilot1(event);
|
||||
}
|
||||
|
||||
// Start of ArduPilot menus 1-8 <<<<<<<<<<<<<<<<<<<<<<<<<<<
|
||||
|
||||
void menuProcArduPilot1(uint8_t event)
|
||||
void menuTelemetryArduPilot1(uint8_t event)
|
||||
{
|
||||
switch(event) // new event received, branch accordingly
|
||||
{
|
||||
case EVT_KEY_FIRST(KEY_UP):
|
||||
chainMenu(menuProcArduPilot8);
|
||||
chainMenu(menuTelemetryArduPilot8);
|
||||
break;
|
||||
case EVT_KEY_FIRST(KEY_DOWN):
|
||||
chainMenu(menuProcArduPilot2);
|
||||
chainMenu(menuTelemetryArduPilot2);
|
||||
break;
|
||||
case EVT_KEY_FIRST(KEY_MENU):
|
||||
ARDUPILOT_DisableRXD();
|
||||
chainMenu(menuProcStatistic);
|
||||
chainMenu(menuStatisticsView);
|
||||
break;
|
||||
case EVT_KEY_FIRST(KEY_EXIT):
|
||||
ARDUPILOT_DisableRXD();
|
||||
@@ -518,15 +518,15 @@ void menuProcArduPilot1(uint8_t event)
|
||||
lcd_putsAtt (1*FW, 5*FH, VALSTR(1), APSIZE);
|
||||
}
|
||||
|
||||
void menuProcArduPilot2(uint8_t event)
|
||||
void menuTelemetryArduPilot2(uint8_t event)
|
||||
{
|
||||
switch(event)
|
||||
{
|
||||
case EVT_KEY_FIRST(KEY_UP):
|
||||
chainMenu(menuProcArduPilot1);
|
||||
chainMenu(menuTelemetryArduPilot1);
|
||||
break;
|
||||
case EVT_KEY_FIRST(KEY_DOWN):
|
||||
chainMenu(menuProcArduPilot3);
|
||||
chainMenu(menuTelemetryArduPilot3);
|
||||
break;
|
||||
case EVT_KEY_FIRST(KEY_EXIT):
|
||||
ARDUPILOT_DisableRXD();
|
||||
@@ -542,15 +542,15 @@ void menuProcArduPilot2(uint8_t event)
|
||||
lcd_putsAtt (2*FW, 5*FH, VALSTR(1), APSIZE);
|
||||
}
|
||||
|
||||
void menuProcArduPilot3(uint8_t event)
|
||||
void menuTelemetryArduPilot3(uint8_t event)
|
||||
{
|
||||
switch(event)
|
||||
{
|
||||
case EVT_KEY_FIRST(KEY_UP):
|
||||
chainMenu(menuProcArduPilot2);
|
||||
chainMenu(menuTelemetryArduPilot2);
|
||||
break;
|
||||
case EVT_KEY_FIRST(KEY_DOWN):
|
||||
chainMenu(menuProcArduPilot4);
|
||||
chainMenu(menuTelemetryArduPilot4);
|
||||
break;
|
||||
case EVT_KEY_FIRST(KEY_EXIT):
|
||||
ARDUPILOT_DisableRXD();
|
||||
@@ -566,15 +566,15 @@ void menuProcArduPilot3(uint8_t event)
|
||||
lcd_putsAtt (2*FW, 5*FH, VALSTR(1), APSIZE);
|
||||
}
|
||||
|
||||
void menuProcArduPilot4(uint8_t event)
|
||||
void menuTelemetryArduPilot4(uint8_t event)
|
||||
{
|
||||
switch(event)
|
||||
{
|
||||
case EVT_KEY_FIRST(KEY_UP):
|
||||
chainMenu(menuProcArduPilot3);
|
||||
chainMenu(menuTelemetryArduPilot3);
|
||||
break;
|
||||
case EVT_KEY_FIRST(KEY_DOWN):
|
||||
chainMenu(menuProcArduPilot5);
|
||||
chainMenu(menuTelemetryArduPilot5);
|
||||
break;
|
||||
case EVT_KEY_FIRST(KEY_EXIT):
|
||||
ARDUPILOT_DisableRXD();
|
||||
@@ -590,15 +590,15 @@ void menuProcArduPilot4(uint8_t event)
|
||||
lcd_putsAtt (2*FW, 5*FH, VALSTR(1), APSIZE);
|
||||
}
|
||||
|
||||
void menuProcArduPilot5(uint8_t event)
|
||||
void menuTelemetryArduPilot5(uint8_t event)
|
||||
{
|
||||
switch(event)
|
||||
{
|
||||
case EVT_KEY_FIRST(KEY_UP):
|
||||
chainMenu(menuProcArduPilot4);
|
||||
chainMenu(menuTelemetryArduPilot4);
|
||||
break;
|
||||
case EVT_KEY_FIRST(KEY_DOWN):
|
||||
chainMenu(menuProcArduPilot6);
|
||||
chainMenu(menuTelemetryArduPilot6);
|
||||
break;
|
||||
case EVT_KEY_FIRST(KEY_MENU):
|
||||
break;
|
||||
@@ -616,15 +616,15 @@ void menuProcArduPilot5(uint8_t event)
|
||||
lcd_putsAtt (2*FW, 5*FH, VALSTR(1), APSIZE);
|
||||
}
|
||||
|
||||
void menuProcArduPilot6(uint8_t event)
|
||||
void menuTelemetryArduPilot6(uint8_t event)
|
||||
{
|
||||
switch(event)
|
||||
{
|
||||
case EVT_KEY_FIRST(KEY_UP):
|
||||
chainMenu(menuProcArduPilot5);
|
||||
chainMenu(menuTelemetryArduPilot5);
|
||||
break;
|
||||
case EVT_KEY_FIRST(KEY_DOWN):
|
||||
chainMenu(menuProcArduPilot7);
|
||||
chainMenu(menuTelemetryArduPilot7);
|
||||
break;
|
||||
case EVT_KEY_FIRST(KEY_MENU):
|
||||
break;
|
||||
@@ -642,15 +642,15 @@ void menuProcArduPilot6(uint8_t event)
|
||||
lcd_putsAtt (2*FW, 5*FH, VALSTR(1), APSIZE);
|
||||
}
|
||||
|
||||
void menuProcArduPilot7(uint8_t event)
|
||||
void menuTelemetryArduPilot7(uint8_t event)
|
||||
{
|
||||
switch(event)
|
||||
{
|
||||
case EVT_KEY_FIRST(KEY_UP):
|
||||
chainMenu(menuProcArduPilot6);
|
||||
chainMenu(menuTelemetryArduPilot6);
|
||||
break;
|
||||
case EVT_KEY_FIRST(KEY_DOWN):
|
||||
chainMenu(menuProcArduPilot8);
|
||||
chainMenu(menuTelemetryArduPilot8);
|
||||
break;
|
||||
case EVT_KEY_FIRST(KEY_MENU):
|
||||
break;
|
||||
@@ -668,15 +668,15 @@ void menuProcArduPilot7(uint8_t event)
|
||||
lcd_putsAtt (2*FW, 5*FH, VALSTR(1), APSIZE);
|
||||
}
|
||||
|
||||
void menuProcArduPilot8(uint8_t event)
|
||||
void menuTelemetryArduPilot8(uint8_t event)
|
||||
{
|
||||
switch(event)
|
||||
{
|
||||
case EVT_KEY_FIRST(KEY_UP):
|
||||
chainMenu(menuProcArduPilot7);
|
||||
chainMenu(menuTelemetryArduPilot7);
|
||||
break;
|
||||
case EVT_KEY_FIRST(KEY_DOWN):
|
||||
chainMenu(menuProcArduPilot1);
|
||||
chainMenu(menuTelemetryArduPilot1);
|
||||
break;
|
||||
case EVT_KEY_FIRST(KEY_MENU):
|
||||
break;
|
||||
|
||||
+1
-1
@@ -35,6 +35,6 @@
|
||||
#define ardupilot_h
|
||||
void ARDUPILOT_Init(void);
|
||||
void ARDUPILOT_EnableRXD (void);
|
||||
void menuProcArduPilot(uint8_t event);
|
||||
void menuTelemetryArduPilot(uint8_t event);
|
||||
#endif
|
||||
|
||||
|
||||
+2
-2
@@ -281,7 +281,7 @@ void parseTelemHubByte(uint8_t byte)
|
||||
// First received GPS position => Pilot GPS position
|
||||
getGpsPilotPosition();
|
||||
}
|
||||
else if (frskyData.hub.gpsDistNeeded || g_menuStack[g_menuStackPtr] == menuProcFrsky) {
|
||||
else if (frskyData.hub.gpsDistNeeded || g_menuStack[g_menuStackPtr] == menuTelemetryFrsky) {
|
||||
getGpsDistance();
|
||||
}
|
||||
break;
|
||||
@@ -1182,7 +1182,7 @@ void displayVoltageScreenLine(uint8_t y, uint8_t index)
|
||||
lcd_putc(12*FW, y, '>'); putsTelemetryChannel(17*FW, y, index+TELEM_A1-1, frskyData.analog[index].max, NO_UNIT);
|
||||
}
|
||||
|
||||
void menuProcFrsky(uint8_t event)
|
||||
void menuTelemetryFrsky(uint8_t event)
|
||||
{
|
||||
switch (event) {
|
||||
case EVT_KEY_BREAK(KEY_UP):
|
||||
|
||||
+29
-29
@@ -52,30 +52,30 @@ enum EnumTabDiag {
|
||||
e_Calib
|
||||
};
|
||||
|
||||
void menuProcSetup(uint8_t event);
|
||||
void menuGeneralSetup(uint8_t event);
|
||||
#if defined(SDCARD)
|
||||
void menuProcSd(uint8_t event);
|
||||
void menuGeneralSdManager(uint8_t event);
|
||||
#endif
|
||||
void menuProcTrainer(uint8_t event);
|
||||
void menuProcDiagVers(uint8_t event);
|
||||
void menuProcDiagKeys(uint8_t event);
|
||||
void menuProcDiagAna(uint8_t event);
|
||||
void menuProcHardware(uint8_t event);
|
||||
void menuProcDiagCalib(uint8_t event);
|
||||
void menuGeneralTrainer(uint8_t event);
|
||||
void menuGeneralVersion(uint8_t event);
|
||||
void menuGeneralDiagKeys(uint8_t event);
|
||||
void menuGeneralDiagAna(uint8_t event);
|
||||
void menuGeneralHardware(uint8_t event);
|
||||
void menuGeneralCalib(uint8_t event);
|
||||
|
||||
const MenuFuncP_PROGMEM menuTabDiag[] PROGMEM = {
|
||||
menuProcSetup,
|
||||
menuGeneralSetup,
|
||||
#if defined(SDCARD)
|
||||
menuProcSd,
|
||||
menuGeneralSdManager,
|
||||
#endif
|
||||
menuProcTrainer,
|
||||
menuProcDiagVers,
|
||||
menuProcDiagKeys,
|
||||
menuProcDiagAna,
|
||||
menuGeneralTrainer,
|
||||
menuGeneralVersion,
|
||||
menuGeneralDiagKeys,
|
||||
menuGeneralDiagAna,
|
||||
#if defined(PCBSKY9X)
|
||||
menuProcHardware,
|
||||
menuGeneralHardware,
|
||||
#endif
|
||||
menuProcDiagCalib
|
||||
menuGeneralCalib
|
||||
};
|
||||
|
||||
#define GENERAL_PARAM_OFS (2+16*FW)
|
||||
@@ -97,7 +97,7 @@ void displaySlider(uint8_t x, uint8_t y, uint8_t value, uint8_t attr)
|
||||
value = selectMenuItem(GENERAL_PARAM_OFS, y, label, values, value, min, max, attr, event)
|
||||
#endif
|
||||
|
||||
enum menuProcSetupItems {
|
||||
enum menuGeneralSetupItems {
|
||||
#if defined(RTCLOCK)
|
||||
ITEM_SETUP_RTC,
|
||||
#endif
|
||||
@@ -152,7 +152,7 @@ enum menuProcSetupItems {
|
||||
ITEM_SETUP_MAX
|
||||
};
|
||||
|
||||
void menuProcSetup(uint8_t event)
|
||||
void menuGeneralSetup(uint8_t event)
|
||||
{
|
||||
#ifdef RTCLOCK
|
||||
#define RTC_ZEROS 5,
|
||||
@@ -200,7 +200,7 @@ void menuProcSetup(uint8_t event)
|
||||
#define ROTARY_ENCODERS_ZEROS
|
||||
#endif
|
||||
|
||||
MENU(STR_MENURADIOSETUP, menuTabDiag, e_Setup, ITEM_SETUP_MAX+1, {0, RTC_ZEROS 0, 0, AUDIO_ZEROS VOICE_ZEROS HAPTIC_ZEROS ARM_ZEROS BLUETOOTH_ZEROS ROTARY_ENCODERS_ZEROS 0, 0, 0, 0, 0, 0, 0, 0, 0, SPLASH_ZEROS 0, 0, 0, 0, FRSKY_ZEROS 0, (uint8_t)-1, 1});
|
||||
MENU(STR_MENURADIOSETUP, menuTabDiag, e_Setup, ITEM_SETUP_MAX+1, {0, RTC_ZEROS 0, 0, AUDIO_ZEROS VOICE_ZEROS HAPTIC_ZEROS ARM_ZEROS 0, 0, 0, BLUETOOTH_ZEROS ROTARY_ENCODERS_ZEROS 0, 0, 0, 0, 0, 0, 0, SPLASH_ZEROS 0, 0, FRSKY_ZEROS 0, (uint8_t)-1, 1});
|
||||
|
||||
uint8_t sub = m_posVert - 1;
|
||||
|
||||
@@ -501,7 +501,7 @@ extern uint32_t sdAvailableAudioFiles; // TODO move that!
|
||||
#endif
|
||||
|
||||
#if defined(SDCARD)
|
||||
void menuProcSdInfo(uint8_t event)
|
||||
void menuGeneralSdManagerInfo(uint8_t event)
|
||||
{
|
||||
SIMPLE_SUBMENU(PSTR("SD INFO"), 1);
|
||||
|
||||
@@ -523,7 +523,7 @@ void menuProcSdInfo(uint8_t event)
|
||||
// lcd_putsLeft(7*FH, PSTR("CSD:"));
|
||||
}
|
||||
|
||||
void menuProcSd(uint8_t event)
|
||||
void menuGeneralSdManager(uint8_t event)
|
||||
{
|
||||
FILINFO fno;
|
||||
DIR dir;
|
||||
@@ -722,7 +722,7 @@ void menuProcSd(uint8_t event)
|
||||
if (result) {
|
||||
uint8_t index = m_posVert-1-s_pgOfs;
|
||||
if (result == STR_SD_INFO) {
|
||||
pushMenu(menuProcSdInfo);
|
||||
pushMenu(menuGeneralSdManagerInfo);
|
||||
}
|
||||
else if (result == STR_SD_FORMAT) {
|
||||
displayPopup(PSTR("Formatting...")); // TODO translations
|
||||
@@ -761,7 +761,7 @@ void menuProcSd(uint8_t event)
|
||||
}
|
||||
#endif
|
||||
|
||||
void menuProcTrainer(uint8_t event)
|
||||
void menuGeneralTrainer(uint8_t event)
|
||||
{
|
||||
uint8_t y;
|
||||
bool slave = SLAVE_MODE;
|
||||
@@ -836,7 +836,7 @@ void menuProcTrainer(uint8_t event)
|
||||
}
|
||||
}
|
||||
|
||||
void menuProcDiagVers(uint8_t event)
|
||||
void menuGeneralVersion(uint8_t event)
|
||||
{
|
||||
SIMPLE_MENU(STR_MENUVERSION, menuTabDiag, e_Vers, 1);
|
||||
|
||||
@@ -854,7 +854,7 @@ void displayKeyState(uint8_t x, uint8_t y, EnumKeys key)
|
||||
lcd_putcAtt(x, y, t+'0', t ? INVERS : 0);
|
||||
}
|
||||
|
||||
void menuProcDiagKeys(uint8_t event)
|
||||
void menuGeneralDiagKeys(uint8_t event)
|
||||
{
|
||||
SIMPLE_MENU(STR_MENUDIAG, menuTabDiag, e_Keys, 1);
|
||||
|
||||
@@ -889,7 +889,7 @@ void menuProcDiagKeys(uint8_t event)
|
||||
|
||||
}
|
||||
|
||||
void menuProcDiagAna(uint8_t event)
|
||||
void menuGeneralDiagAna(uint8_t event)
|
||||
{
|
||||
#if defined(PCBSKY9X) && defined(REVB)
|
||||
#define ANAS_ITEMS_COUNT 4
|
||||
@@ -950,14 +950,14 @@ void menuProcDiagAna(uint8_t event)
|
||||
}
|
||||
|
||||
#if defined(PCBSKY9X)
|
||||
enum menuProcHwItems {
|
||||
enum menuGeneralHwItems {
|
||||
ITEM_SETUP_HW_COPROC,
|
||||
ITEM_SETUP_HW_OPTREX_DISPLAY,
|
||||
ITEM_SETUP_HW_MAX
|
||||
};
|
||||
|
||||
#define GENERAL_HW_PARAM_OFS (2+(15*FW))
|
||||
void menuProcHardware(uint8_t event)
|
||||
void menuGeneralHardware(uint8_t event)
|
||||
{
|
||||
MENU(PSTR("Hardware"), menuTabDiag, e_Hardware, ITEM_SETUP_HW_MAX+1, {0, (uint8_t)-1, 0});
|
||||
|
||||
@@ -986,7 +986,7 @@ void menuProcHardware(uint8_t event)
|
||||
}
|
||||
#endif
|
||||
|
||||
void menuProcDiagCalib(uint8_t event)
|
||||
void menuGeneralCalib(uint8_t event)
|
||||
{
|
||||
SIMPLE_MENU(STR_MENUCALIBRATION, menuTabDiag, e_Calib, 1);
|
||||
|
||||
|
||||
+1
-1
@@ -179,7 +179,7 @@ void JETI_put_stop (void)
|
||||
|
||||
extern void menuMainView(uint8_t event);
|
||||
|
||||
void menuProcJeti(uint8_t event)
|
||||
void menuTelemetryJeti(uint8_t event)
|
||||
{
|
||||
TITLE("JETI");
|
||||
|
||||
|
||||
+1
-1
@@ -57,7 +57,7 @@ void JETI_puts (char *s);
|
||||
void JETI_put_start (void);
|
||||
void JETI_put_stop (void);
|
||||
|
||||
void menuProcJeti(uint8_t event);
|
||||
void menuTelemetryJeti(uint8_t event);
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
+9
-9
@@ -112,11 +112,11 @@ void menuMainView(uint8_t event)
|
||||
}
|
||||
break;
|
||||
case EVT_KEY_LONG(KEY_RIGHT):
|
||||
pushMenu(menuProcModelSelect);
|
||||
pushMenu(menuModelSelect);
|
||||
killEvents(event);
|
||||
break;
|
||||
case EVT_KEY_LONG(KEY_LEFT):
|
||||
pushMenu(menuProcSetup);
|
||||
pushMenu(menuGeneralSetup);
|
||||
killEvents(event);
|
||||
break;
|
||||
case EVT_KEY_BREAK(KEY_UP):
|
||||
@@ -126,25 +126,25 @@ void menuMainView(uint8_t event)
|
||||
AUDIO_KEYPAD_UP();
|
||||
break;
|
||||
case EVT_KEY_LONG(KEY_UP):
|
||||
chainMenu(menuProcStatistic);
|
||||
chainMenu(menuStatisticsView);
|
||||
killEvents(event);
|
||||
break;
|
||||
case EVT_KEY_LONG(KEY_DOWN):
|
||||
#if defined(FRSKY)
|
||||
chainMenu(menuProcFrsky);
|
||||
chainMenu(menuTelemetryFrsky);
|
||||
#elif defined(JETI)
|
||||
JETI_EnableRXD(); // enable JETI-Telemetry reception
|
||||
chainMenu(menuProcJeti);
|
||||
chainMenu(menuTelemetryJeti);
|
||||
#elif defined(ARDUPILOT)
|
||||
ARDUPILOT_EnableRXD(); // enable ArduPilot-Telemetry reception
|
||||
chainMenu(menuProcArduPilot);
|
||||
chainMenu(menuTelemetryArduPilot);
|
||||
#elif defined(NMEA)
|
||||
NMEA_EnableRXD(); // enable NMEA-Telemetry reception
|
||||
chainMenu(menuProcNMEA);
|
||||
chainMenu(menuTelemetryNMEA);
|
||||
#elif defined(MAVLINK)
|
||||
chainMenu(menuProcMavlink);
|
||||
chainMenu(menuTelemetryMavlink);
|
||||
#else
|
||||
chainMenu(menuProcDebug);
|
||||
chainMenu(menuStatisticsDebug);
|
||||
#endif
|
||||
killEvents(event);
|
||||
break;
|
||||
|
||||
+7
-7
@@ -745,7 +745,7 @@ void MAVLINK_ReqMode(uint8_t mode, uint8_t send) {
|
||||
}
|
||||
}
|
||||
|
||||
void menuProcMavlinkInfos(void) {
|
||||
void menuTelemetryMavlinkInfos(void) {
|
||||
|
||||
mav_title(PSTR("INFOS"), MAVLINK_menu);
|
||||
|
||||
@@ -788,7 +788,7 @@ void menuProcMavlinkInfos(void) {
|
||||
|
||||
}
|
||||
|
||||
void menuProcMavlinkGPS(void) {
|
||||
void menuTelemetryMavlinkGPS(void) {
|
||||
mav_title(PSTR("GPS"), MAVLINK_menu);
|
||||
|
||||
uint8_t x1, x2, xnum, y;
|
||||
@@ -847,7 +847,7 @@ void lcd_outhex2(uint8_t x, uint8_t y, uint8_t val) {
|
||||
}
|
||||
}
|
||||
|
||||
void menuProcMavlinkDump(uint8_t event) {
|
||||
void menuTelemetryMavlinkDump(uint8_t event) {
|
||||
uint8_t x = 0;
|
||||
uint8_t y = FH;
|
||||
uint16_t count = 0;
|
||||
@@ -885,7 +885,7 @@ void menuProcMavlinkDump(uint8_t event) {
|
||||
}
|
||||
#endif
|
||||
|
||||
void menuProcMavlink(uint8_t event) {
|
||||
void menuTelemetryMavlink(uint8_t event) {
|
||||
|
||||
switch (event) // new event received, branch accordingly
|
||||
{
|
||||
@@ -908,15 +908,15 @@ void menuProcMavlink(uint8_t event) {
|
||||
|
||||
switch (MAVLINK_menu) {
|
||||
case MENU_INFO:
|
||||
menuProcMavlinkInfos();
|
||||
menuTelemetryMavlinkInfos();
|
||||
break;
|
||||
case MENU_GPS:
|
||||
menuProcMavlinkGPS();
|
||||
menuTelemetryMavlinkGPS();
|
||||
break;
|
||||
#ifdef DUMP_RX_TX
|
||||
case MENU_DUMP_TX:
|
||||
case MENU_DUMP_RX:
|
||||
menuProcMavlinkDump(event);
|
||||
menuTelemetryMavlinkDump(event);
|
||||
break;
|
||||
#endif
|
||||
|
||||
|
||||
+1
-1
@@ -261,7 +261,7 @@ extern inline uint8_t MAVLINK_Action2CtrlMode(uint8_t action) {
|
||||
#endif
|
||||
void check_mavlink();
|
||||
void MAVLINK_Init(void);
|
||||
void menuProcMavlink(uint8_t event);
|
||||
void menuTelemetryMavlink(uint8_t event);
|
||||
void MAVLINK10mspoll(uint16_t time);
|
||||
|
||||
#ifdef MAVLINK_PARAMS
|
||||
|
||||
+2
-2
@@ -509,9 +509,9 @@ void pushMenu(MenuFuncP newMenu)
|
||||
#endif
|
||||
|
||||
if (g_menuStackPtr == 0) {
|
||||
if (newMenu == menuProcSetup)
|
||||
if (newMenu == menuGeneralSetup)
|
||||
g_menuPos[0] = 1;
|
||||
if (newMenu == menuProcModelSelect)
|
||||
if (newMenu == menuModelSelect)
|
||||
g_menuPos[0] = 0;
|
||||
}
|
||||
else {
|
||||
|
||||
+8
-8
@@ -70,17 +70,17 @@ inline MenuFuncP lastPopMenu()
|
||||
|
||||
void doMainScreenGrphics();
|
||||
void menuMainView(uint8_t event);
|
||||
void menuProcDiagAna(uint8_t event);
|
||||
void menuGeneralDiagAna(uint8_t event);
|
||||
#ifdef FRSKY
|
||||
void menuProcFrsky(uint8_t event);
|
||||
void menuTelemetryFrsky(uint8_t event);
|
||||
#endif
|
||||
void menuProcSetup(uint8_t event);
|
||||
void menuProcDiagCalib(uint8_t event);
|
||||
void menuGeneralSetup(uint8_t event);
|
||||
void menuGeneralCalib(uint8_t event);
|
||||
|
||||
void menuProcModelSelect(uint8_t event);
|
||||
void menuProcFunctionSwitches(uint8_t event);
|
||||
void menuProcStatistic(uint8_t event);
|
||||
void menuProcDebug(uint8_t event);
|
||||
void menuModelSelect(uint8_t event);
|
||||
void menuModelFunctionSwitches(uint8_t event);
|
||||
void menuStatisticsView(uint8_t event);
|
||||
void menuStatisticsDebug(uint8_t event);
|
||||
|
||||
#if defined(ROTARY_ENCODERS)
|
||||
extern int8_t scrollRE;
|
||||
|
||||
+58
-58
@@ -62,50 +62,50 @@ enum EnumTabModel {
|
||||
#endif
|
||||
};
|
||||
|
||||
void menuProcModelSelect(uint8_t event);
|
||||
void menuProcModel(uint8_t event);
|
||||
void menuModelSelect(uint8_t event);
|
||||
void menuModelSetup(uint8_t event);
|
||||
#ifdef HELI
|
||||
void menuProcHeli(uint8_t event);
|
||||
void menuModelHeli(uint8_t event);
|
||||
#endif
|
||||
#ifdef FLIGHT_PHASES
|
||||
void menuProcPhasesAll(uint8_t event);
|
||||
void menuModelPhasesAll(uint8_t event);
|
||||
#endif
|
||||
void menuProcExposAll(uint8_t event);
|
||||
void menuProcMixAll(uint8_t event);
|
||||
void menuProcLimits(uint8_t event);
|
||||
void menuProcCurvesAll(uint8_t event);
|
||||
void menuProcCustomSwitches(uint8_t event);
|
||||
void menuProcFunctionSwitches(uint8_t event);
|
||||
void menuModelExposAll(uint8_t event);
|
||||
void menuModelMixAll(uint8_t event);
|
||||
void menuModelLimits(uint8_t event);
|
||||
void menuModelCurvesAll(uint8_t event);
|
||||
void menuModelCustomSwitches(uint8_t event);
|
||||
void menuModelFunctionSwitches(uint8_t event);
|
||||
#ifdef FRSKY
|
||||
void menuProcTelemetry(uint8_t event);
|
||||
void menuModelTelemetry(uint8_t event);
|
||||
#endif
|
||||
#ifdef TEMPLATES
|
||||
void menuProcTemplates(uint8_t event);
|
||||
void menuModelTemplates(uint8_t event);
|
||||
#endif
|
||||
void menuProcExpoOne(uint8_t event);
|
||||
void menuModelExpoOne(uint8_t event);
|
||||
|
||||
const MenuFuncP_PROGMEM menuTabModel[] PROGMEM = {
|
||||
menuProcModelSelect,
|
||||
menuProcModel,
|
||||
menuModelSelect,
|
||||
menuModelSetup,
|
||||
#ifdef HELI
|
||||
menuProcHeli,
|
||||
menuModelHeli,
|
||||
#endif
|
||||
#ifdef FLIGHT_PHASES
|
||||
menuProcPhasesAll,
|
||||
menuModelPhasesAll,
|
||||
#endif
|
||||
menuProcExposAll,
|
||||
menuProcMixAll,
|
||||
menuProcLimits,
|
||||
menuModelExposAll,
|
||||
menuModelMixAll,
|
||||
menuModelLimits,
|
||||
#ifdef CURVES
|
||||
menuProcCurvesAll,
|
||||
menuModelCurvesAll,
|
||||
#endif
|
||||
menuProcCustomSwitches,
|
||||
menuProcFunctionSwitches,
|
||||
menuModelCustomSwitches,
|
||||
menuModelFunctionSwitches,
|
||||
#ifdef FRSKY
|
||||
menuProcTelemetry,
|
||||
menuModelTelemetry,
|
||||
#endif
|
||||
#ifdef TEMPLATES
|
||||
menuProcTemplates
|
||||
menuModelTemplates
|
||||
#endif
|
||||
};
|
||||
|
||||
@@ -183,7 +183,7 @@ bool listSdFiles(const char *path, const char *extension)
|
||||
}
|
||||
#endif
|
||||
|
||||
void menuProcModelSelect(uint8_t event)
|
||||
void menuModelSelect(uint8_t event)
|
||||
{
|
||||
TITLE(STR_MENUMODELSEL);
|
||||
|
||||
@@ -240,7 +240,7 @@ void menuProcModelSelect(uint8_t event)
|
||||
|
||||
#if defined(ROTARY_ENCODERS)
|
||||
if (scrollRE > 0 && s_editMode < 0) {
|
||||
chainMenu(menuProcModel);
|
||||
chainMenu(menuModelSetup);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
@@ -352,7 +352,7 @@ void menuProcModelSelect(uint8_t event)
|
||||
case EVT_KEY_FIRST(KEY_LEFT):
|
||||
case EVT_KEY_FIRST(KEY_RIGHT):
|
||||
if (sub == g_eeGeneral.currModel) {
|
||||
chainMenu(event == EVT_KEY_FIRST(KEY_RIGHT) ? menuProcModel : menuTabModel[DIM(menuTabModel)-1]);
|
||||
chainMenu(event == EVT_KEY_FIRST(KEY_RIGHT) ? menuModelSetup : menuTabModel[DIM(menuTabModel)-1]);
|
||||
return;
|
||||
}
|
||||
AUDIO_WARNING2();
|
||||
@@ -549,7 +549,7 @@ void EditName(uint8_t x, uint8_t y, char *name, uint8_t size, uint8_t event, boo
|
||||
}
|
||||
}
|
||||
|
||||
enum menuProcModelItems {
|
||||
enum menuModelSetupItems {
|
||||
ITEM_MODEL_NAME,
|
||||
ITEM_MODEL_TIMER1,
|
||||
ITEM_MODEL_TIMER2,
|
||||
@@ -572,7 +572,7 @@ enum menuProcModelItems {
|
||||
#endif
|
||||
|
||||
#define MODEL_PARAM_OFS (10*FW+2)
|
||||
void menuProcModel(uint8_t event)
|
||||
void menuModelSetup(uint8_t event)
|
||||
{
|
||||
lcd_outdezNAtt(7*FW,0,g_eeGeneral.currModel+1,INVERS+LEADING0,2);
|
||||
|
||||
@@ -875,7 +875,7 @@ PhasesType editPhases(uint8_t x, uint8_t y, uint8_t event, PhasesType value, uin
|
||||
return value;
|
||||
}
|
||||
|
||||
void menuProcPhaseOne(uint8_t event)
|
||||
void menuModelPhaseOne(uint8_t event)
|
||||
{
|
||||
PhaseData *phase = phaseaddress(s_currIdx);
|
||||
putsFlightPhase(13*FW, 0, s_currIdx+1, (getFlightPhase()==s_currIdx ? BOLD : 0));
|
||||
@@ -950,7 +950,7 @@ void menuProcPhaseOne(uint8_t event)
|
||||
}
|
||||
}
|
||||
|
||||
void menuProcPhasesAll(uint8_t event)
|
||||
void menuModelPhasesAll(uint8_t event)
|
||||
{
|
||||
SIMPLE_MENU(STR_MENUFLIGHTPHASES, menuTabModel, e_PhasesAll, 1+MAX_PHASES+1);
|
||||
|
||||
@@ -973,7 +973,7 @@ void menuProcPhasesAll(uint8_t event)
|
||||
case EVT_KEY_FIRST(KEY_RIGHT):
|
||||
if (sub >= 0 && sub < MAX_PHASES) {
|
||||
s_currIdx = sub;
|
||||
pushMenu(menuProcPhaseOne);
|
||||
pushMenu(menuModelPhaseOne);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -1042,7 +1042,7 @@ void menuProcPhasesAll(uint8_t event)
|
||||
|
||||
#ifdef HELI
|
||||
|
||||
enum menuProcHeliItems {
|
||||
enum menuModelHeliItems {
|
||||
ITEM_HELI_SWASHTYPE,
|
||||
ITEM_HELI_COLLECTIVE,
|
||||
ITEM_HELI_SWASHRING,
|
||||
@@ -1053,7 +1053,7 @@ enum menuProcHeliItems {
|
||||
|
||||
#define HELI_PARAM_OFS (14*FW)
|
||||
|
||||
void menuProcHeli(uint8_t event)
|
||||
void menuModelHeli(uint8_t event)
|
||||
{
|
||||
SIMPLE_MENU(STR_MENUHELISETUP, menuTabModel, e_Heli, 7);
|
||||
|
||||
@@ -1161,7 +1161,7 @@ bool moveCurve(uint8_t index, int8_t shift, int8_t custom=0)
|
||||
return true;
|
||||
}
|
||||
|
||||
void menuProcCurveOne(uint8_t event)
|
||||
void menuModelCurveOne(uint8_t event)
|
||||
{
|
||||
TITLE(STR_MENUCURVE);
|
||||
lcd_outdezAtt(5*FW+1, 0, s_curveChan+1, INVERS|LEFT);
|
||||
@@ -1491,7 +1491,7 @@ enum ExposFields {
|
||||
#define EXPO_ONE_PHASES_ROW
|
||||
#endif
|
||||
|
||||
void menuProcExpoOne(uint8_t event)
|
||||
void menuModelExpoOne(uint8_t event)
|
||||
{
|
||||
ExpoData *ed = expoaddress(s_currIdx);
|
||||
putsChnRaw(7*FW+FW/2,0,ed->chn+1,0);
|
||||
@@ -1537,7 +1537,7 @@ void menuProcExpoOne(uint8_t event)
|
||||
if (ed->curveParam) ed->curveMode = MODE_CURVE;
|
||||
if (ed->curveParam>=CURVE_BASE && event==EVT_KEY_FIRST(KEY_MENU)) {
|
||||
s_curveChan = ed->curveParam - CURVE_BASE;
|
||||
pushMenu(menuProcCurveOne);
|
||||
pushMenu(menuModelCurveOne);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1616,7 +1616,7 @@ enum MixFields {
|
||||
#define MIX_ONE_PHASES_ROW
|
||||
#endif
|
||||
|
||||
void menuProcMixOne(uint8_t event)
|
||||
void menuModelMixOne(uint8_t event)
|
||||
{
|
||||
TITLEP(s_currCh ? STR_INSERTMIX : STR_EDITMIX);
|
||||
MixData *md2 = mixaddress(s_currIdx) ;
|
||||
@@ -1676,7 +1676,7 @@ void menuProcMixOne(uint8_t event)
|
||||
if (md2->curveMode==MODE_CURVE) {
|
||||
if (event==EVT_KEY_FIRST(KEY_MENU) && (curveParam<0 || curveParam>=CURVE_BASE)){
|
||||
s_curveChan = (curveParam<0 ? -curveParam-1 : curveParam-CURVE_BASE);
|
||||
pushMenu(menuProcCurveOne);
|
||||
pushMenu(menuModelCurveOne);
|
||||
}
|
||||
else {
|
||||
CHECK_INCDEC_MODELVAR(event, md2->curveParam, -MAX_CURVES, CURVE_BASE+MAX_CURVES-1);
|
||||
@@ -1765,7 +1765,7 @@ static uint8_t s_copySrcCh;
|
||||
#define EXPO_LINE_SELECT_POS 18
|
||||
#endif
|
||||
|
||||
void menuProcExpoMix(uint8_t expo, uint8_t _event)
|
||||
void menuModelExpoMix(uint8_t expo, uint8_t _event)
|
||||
{
|
||||
uint8_t event = _event;
|
||||
uint8_t key = (event & 0x1f);
|
||||
@@ -1852,7 +1852,7 @@ void menuProcExpoMix(uint8_t expo, uint8_t _event)
|
||||
if (reachExpoMixCountLimit(expo)) break;
|
||||
insertExpoMix(expo, s_currIdx);
|
||||
}
|
||||
pushMenu(expo ? menuProcExpoOne : menuProcMixOne);
|
||||
pushMenu(expo ? menuModelExpoOne : menuModelMixOne);
|
||||
s_copyMode = 0;
|
||||
return;
|
||||
}
|
||||
@@ -1864,7 +1864,7 @@ void menuProcExpoMix(uint8_t expo, uint8_t _event)
|
||||
s_currCh = (expo ? expoaddress(s_currIdx)->chn+1 : mixaddress(s_currIdx)->destCh+1);
|
||||
if (_event == EVT_KEY_LONG(KEY_RIGHT)) s_currIdx++;
|
||||
insertExpoMix(expo, s_currIdx);
|
||||
pushMenu(expo ? menuProcExpoOne : menuProcMixOne);
|
||||
pushMenu(expo ? menuModelExpoOne : menuModelMixOne);
|
||||
s_copyMode = 0;
|
||||
killEvents(_event);
|
||||
return;
|
||||
@@ -2033,14 +2033,14 @@ void menuProcExpoMix(uint8_t expo, uint8_t _event)
|
||||
if (sub >= s_maxLines-1) m_posVert = s_maxLines-1;
|
||||
}
|
||||
|
||||
void menuProcExposAll(uint8_t event)
|
||||
void menuModelExposAll(uint8_t event)
|
||||
{
|
||||
return menuProcExpoMix(1, event);
|
||||
return menuModelExpoMix(1, event);
|
||||
}
|
||||
|
||||
void menuProcMixAll(uint8_t event)
|
||||
void menuModelMixAll(uint8_t event)
|
||||
{
|
||||
return menuProcExpoMix(0, event);
|
||||
return menuModelExpoMix(0, event);
|
||||
}
|
||||
|
||||
bool thrOutput(uint8_t ch)
|
||||
@@ -2091,7 +2091,7 @@ enum LimitsItems {
|
||||
#endif
|
||||
|
||||
|
||||
void menuProcLimits(uint8_t event)
|
||||
void menuModelLimits(uint8_t event)
|
||||
{
|
||||
MENU(STR_MENULIMITS, menuTabModel, e_Limits, 1+NUM_CHNOUT+1, {0, ITEM_LIMITS_MAXROW, ITEM_LIMITS_MAXROW, ITEM_LIMITS_MAXROW, ITEM_LIMITS_MAXROW, ITEM_LIMITS_MAXROW, ITEM_LIMITS_MAXROW, ITEM_LIMITS_MAXROW, ITEM_LIMITS_MAXROW, ITEM_LIMITS_MAXROW, ITEM_LIMITS_MAXROW, ITEM_LIMITS_MAXROW, ITEM_LIMITS_MAXROW, ITEM_LIMITS_MAXROW, ITEM_LIMITS_MAXROW, ITEM_LIMITS_MAXROW, ITEM_LIMITS_MAXROW, 0});
|
||||
|
||||
@@ -2252,7 +2252,7 @@ void menuProcLimits(uint8_t event)
|
||||
}
|
||||
|
||||
#if defined(CURVES)
|
||||
void menuProcCurvesAll(uint8_t event)
|
||||
void menuModelCurvesAll(uint8_t event)
|
||||
{
|
||||
SIMPLE_MENU(STR_MENUCURVES, menuTabModel, e_CurvesAll, 1+MAX_CURVES);
|
||||
|
||||
@@ -2270,7 +2270,7 @@ void menuProcCurvesAll(uint8_t event)
|
||||
case EVT_KEY_FIRST(KEY_MENU):
|
||||
if (sub >= 0) {
|
||||
s_curveChan = sub;
|
||||
pushMenu(menuProcCurveOne);
|
||||
pushMenu(menuModelCurveOne);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -2299,7 +2299,7 @@ enum CustomSwitchFields {
|
||||
CSW_FIELD_COUNT
|
||||
};
|
||||
#define CSW_2ND_COLUMN (9*FW)
|
||||
void menuProcCustomSwitchOne(uint8_t event)
|
||||
void menuModelCustomSwitchOne(uint8_t event)
|
||||
{
|
||||
TITLEP(STR_MENUCUSTOMSWITCH);
|
||||
CustomSwData * cs = cswaddress(s_currIdx);
|
||||
@@ -2404,7 +2404,7 @@ void menuProcCustomSwitchOne(uint8_t event)
|
||||
}
|
||||
}
|
||||
|
||||
void menuProcCustomSwitches(uint8_t event)
|
||||
void menuModelCustomSwitches(uint8_t event)
|
||||
{
|
||||
SIMPLE_MENU(STR_MENUCUSTOMSWITCHES, menuTabModel, e_CustomSwitches, NUM_CSW+1);
|
||||
|
||||
@@ -2424,7 +2424,7 @@ void menuProcCustomSwitches(uint8_t event)
|
||||
case EVT_KEY_FIRST(KEY_MENU):
|
||||
if (sub >= 0) {
|
||||
s_currIdx = sub;
|
||||
pushMenu(menuProcCustomSwitchOne);
|
||||
pushMenu(menuModelCustomSwitchOne);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -2470,7 +2470,7 @@ void menuProcCustomSwitches(uint8_t event)
|
||||
}
|
||||
}
|
||||
#else
|
||||
void menuProcCustomSwitches(uint8_t event)
|
||||
void menuModelCustomSwitches(uint8_t event)
|
||||
{
|
||||
MENU(STR_MENUCUSTOMSWITCHES, menuTabModel, e_CustomSwitches, NUM_CSW+1, {0, 2/*repeated...*/});
|
||||
|
||||
@@ -2554,7 +2554,7 @@ void menuProcCustomSwitches(uint8_t event)
|
||||
}
|
||||
#endif
|
||||
|
||||
void menuProcFunctionSwitches(uint8_t event)
|
||||
void menuModelFunctionSwitches(uint8_t event)
|
||||
{
|
||||
#if defined(PCBSKY9X) && defined(SDCARD)
|
||||
uint8_t _event = event;
|
||||
@@ -2736,7 +2736,7 @@ void menuProcFunctionSwitches(uint8_t event)
|
||||
#endif
|
||||
}
|
||||
|
||||
enum menuProcTelemetryItems {
|
||||
enum menuModelTelemetryItems {
|
||||
ITEM_TELEMETRY_A1_LABEL,
|
||||
ITEM_TELEMETRY_A1_RANGE,
|
||||
ITEM_TELEMETRY_A1_OFFSET,
|
||||
@@ -2793,7 +2793,7 @@ enum menuProcTelemetryItems {
|
||||
#define TELEM_COL2 (8*FW)
|
||||
#endif
|
||||
|
||||
void menuProcTelemetry(uint8_t event)
|
||||
void menuModelTelemetry(uint8_t event)
|
||||
{
|
||||
MENU(STR_MENUTELEMETRY, menuTabModel, e_Telemetry, ITEM_TELEMETRY_MAX+1, {0, (uint8_t)-1, 1, 0, 2, 2, (uint8_t)-1, 1, 0, 2, 2, (uint8_t)-1, 1, 1, USRDATA_LINES 0, 0, VARIO_LINES (uint8_t)-1, 1, 1, 1, 1, (uint8_t)-1, 2, 2, 2, 2});
|
||||
|
||||
@@ -3051,7 +3051,7 @@ void menuProcTelemetry(uint8_t event)
|
||||
#endif
|
||||
|
||||
#ifdef TEMPLATES
|
||||
void menuProcTemplates(uint8_t event)
|
||||
void menuModelTemplates(uint8_t event)
|
||||
{
|
||||
SIMPLE_MENU(STR_MENUTEMPLATES, menuTabModel, e_Templates, 1+TMPL_COUNT);
|
||||
|
||||
|
||||
+22
-22
@@ -173,10 +173,10 @@ $GPRMC - Recommended Minimum Navigation Information
|
||||
#define WAIT_VAL_END 7
|
||||
#define READ_VALUE 8
|
||||
|
||||
void menuProcNMEA1(uint8_t event);
|
||||
void menuProcNMEA2(uint8_t event);
|
||||
void menuProcNMEA3(uint8_t event);
|
||||
void menuProcNMEA4(uint8_t event);
|
||||
void menuTelemetryNMEA1(uint8_t event);
|
||||
void menuTelemetryNMEA2(uint8_t event);
|
||||
void menuTelemetryNMEA3(uint8_t event);
|
||||
void menuTelemetryNMEA4(uint8_t event);
|
||||
void title(char x);
|
||||
void initval(uint8_t num, uint8_t pack, uint8_t val);
|
||||
int32_t binary (char *str);
|
||||
@@ -381,26 +381,26 @@ void NMEA_EnableRXD (void)
|
||||
UCSR0B |= (1 << RXCIE0); // enable Interrupt
|
||||
}
|
||||
|
||||
void menuProcNMEA(uint8_t event)
|
||||
void menuTelemetryNMEA(uint8_t event)
|
||||
{
|
||||
menuProcNMEA1(event);
|
||||
menuTelemetryNMEA1(event);
|
||||
}
|
||||
|
||||
// Start of NMEA menus 1-4 <<<<<<<<<<<<<<<<<<<<<<<<<<<
|
||||
|
||||
void menuProcNMEA1(uint8_t event)
|
||||
void menuTelemetryNMEA1(uint8_t event)
|
||||
{
|
||||
switch(event) // new event received, branch accordingly
|
||||
{
|
||||
case EVT_KEY_BREAK(KEY_LEFT):
|
||||
chainMenu(menuProcNMEA4);
|
||||
chainMenu(menuTelemetryNMEA4);
|
||||
break;
|
||||
case EVT_KEY_BREAK(KEY_RIGHT):
|
||||
chainMenu(menuProcNMEA2);
|
||||
chainMenu(menuTelemetryNMEA2);
|
||||
break;
|
||||
case EVT_KEY_LONG(KEY_UP):
|
||||
NMEA_DisableRXD();
|
||||
chainMenu(menuProcStatistic);
|
||||
chainMenu(menuStatisticsView);
|
||||
break;
|
||||
case EVT_KEY_LONG(KEY_DOWN):
|
||||
NMEA_DisableRXD();
|
||||
@@ -494,7 +494,7 @@ void menuProcNMEA1(uint8_t event)
|
||||
|
||||
|
||||
|
||||
void menuProcNMEA2(uint8_t event)
|
||||
void menuTelemetryNMEA2(uint8_t event)
|
||||
{
|
||||
static uint8_t ignore_break;
|
||||
|
||||
@@ -506,17 +506,17 @@ void menuProcNMEA2(uint8_t event)
|
||||
if (ignore_break==1) {
|
||||
ignore_break=0;
|
||||
break;}
|
||||
chainMenu(menuProcNMEA1);
|
||||
chainMenu(menuTelemetryNMEA1);
|
||||
break;
|
||||
case EVT_KEY_BREAK(KEY_RIGHT):
|
||||
if (ignore_break==1) {
|
||||
ignore_break=0;
|
||||
break;}
|
||||
chainMenu(menuProcNMEA3);
|
||||
chainMenu(menuTelemetryNMEA3);
|
||||
break;
|
||||
case EVT_KEY_LONG(KEY_UP):
|
||||
NMEA_DisableRXD();
|
||||
chainMenu(menuProcStatistic);
|
||||
chainMenu(menuStatisticsView);
|
||||
break;
|
||||
case EVT_KEY_LONG(KEY_DOWN):
|
||||
NMEA_DisableRXD();
|
||||
@@ -656,19 +656,19 @@ void menuProcNMEA2(uint8_t event)
|
||||
|
||||
|
||||
|
||||
void menuProcNMEA3(uint8_t event)
|
||||
void menuTelemetryNMEA3(uint8_t event)
|
||||
{
|
||||
switch(event)
|
||||
{
|
||||
case EVT_KEY_BREAK(KEY_LEFT):
|
||||
chainMenu(menuProcNMEA2);
|
||||
chainMenu(menuTelemetryNMEA2);
|
||||
break;
|
||||
case EVT_KEY_BREAK(KEY_RIGHT):
|
||||
chainMenu(menuProcNMEA4);
|
||||
chainMenu(menuTelemetryNMEA4);
|
||||
break;
|
||||
case EVT_KEY_LONG(KEY_UP):
|
||||
NMEA_DisableRXD();
|
||||
chainMenu(menuProcStatistic);
|
||||
chainMenu(menuStatisticsView);
|
||||
break;
|
||||
case EVT_KEY_LONG(KEY_DOWN):
|
||||
NMEA_DisableRXD();
|
||||
@@ -705,19 +705,19 @@ void menuProcNMEA3(uint8_t event)
|
||||
|
||||
|
||||
|
||||
void menuProcNMEA4(uint8_t event)
|
||||
void menuTelemetryNMEA4(uint8_t event)
|
||||
{
|
||||
switch(event) // new event received, branch accordingly
|
||||
{
|
||||
case EVT_KEY_BREAK(KEY_LEFT):
|
||||
chainMenu(menuProcNMEA3);
|
||||
chainMenu(menuTelemetryNMEA3);
|
||||
break;
|
||||
case EVT_KEY_BREAK(KEY_RIGHT):
|
||||
chainMenu(menuProcNMEA1);
|
||||
chainMenu(menuTelemetryNMEA1);
|
||||
break;
|
||||
case EVT_KEY_LONG(KEY_UP):
|
||||
NMEA_DisableRXD();
|
||||
chainMenu(menuProcStatistic);
|
||||
chainMenu(menuStatisticsView);
|
||||
break;
|
||||
case EVT_KEY_LONG(KEY_DOWN):
|
||||
NMEA_DisableRXD();
|
||||
|
||||
+1
-1
@@ -36,7 +36,7 @@
|
||||
|
||||
void NMEA_Init(void);
|
||||
void NMEA_EnableRXD (void);
|
||||
void menuProcNMEA(uint8_t event);
|
||||
void menuTelemetryNMEA(uint8_t event);
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
+4
-4
@@ -1902,7 +1902,7 @@ void evalFunctions()
|
||||
if (sd->func == FUNC_INSTANT_TRIM) {
|
||||
if (g_menuStack[0] == menuMainView
|
||||
#if defined(FRSKY)
|
||||
|| g_menuStack[0] == menuProcFrsky
|
||||
|| g_menuStack[0] == menuTelemetryFrsky
|
||||
#endif
|
||||
)
|
||||
instantTrim();
|
||||
@@ -2731,7 +2731,7 @@ void perMain()
|
||||
if (counter-- == 0) {
|
||||
counter = 10;
|
||||
#else
|
||||
if ((tmr10ms & 0x1f) == 2 /*every 10ms*32*/ || g_menuStack[g_menuStackPtr] == menuProcDiagAna) {
|
||||
if ((tmr10ms & 0x1f) == 2 /*every 10ms*32*/ || g_menuStack[g_menuStackPtr] == menuGeneralDiagAna) {
|
||||
#endif
|
||||
|
||||
#if defined(PCBSKY9X)
|
||||
@@ -2752,7 +2752,7 @@ void perMain()
|
||||
s_batCheck += 32;
|
||||
s_batSum += instant_vbat;
|
||||
|
||||
if (g_vbat100mV == 0 || g_menuStack[g_menuStackPtr] == menuProcDiagAna) {
|
||||
if (g_vbat100mV == 0 || g_menuStack[g_menuStackPtr] == menuGeneralDiagAna) {
|
||||
g_vbat100mV = instant_vbat;
|
||||
s_batSum = 0;
|
||||
s_batCheck = 0;
|
||||
@@ -3391,7 +3391,7 @@ int main(void)
|
||||
stack_paint();
|
||||
|
||||
g_menuStack[0] = menuMainView;
|
||||
g_menuStack[1] = menuProcModelSelect;
|
||||
g_menuStack[1] = menuModelSelect;
|
||||
|
||||
lcdSetRefVolt(25);
|
||||
|
||||
|
||||
+2
-2
@@ -1084,7 +1084,7 @@ union ReusableBuffer
|
||||
|
||||
struct
|
||||
{
|
||||
char mainname[42]; // used by menuProcModelSelect and for SD card archive / restore
|
||||
char mainname[42]; // used by menuModelSelect and for SD card archive / restore
|
||||
char listnames[7][10];
|
||||
uint16_t listsizes[7];
|
||||
uint16_t eepromfree;
|
||||
@@ -1095,7 +1095,7 @@ union ReusableBuffer
|
||||
int16_t midVals[7];
|
||||
int16_t loVals[7];
|
||||
int16_t hiVals[7];
|
||||
} calib; // used by menuProcDiagCalib
|
||||
} calib; // used by menuGeneralCalib
|
||||
|
||||
#if defined(SDCARD)
|
||||
struct
|
||||
|
||||
@@ -25,8 +25,6 @@ extern void putsRotarySwPos(uint8_t x, uint8_t y, uint8_t idx1, uint8_t att);
|
||||
extern void setRotarySwIdx(int8_t idx);
|
||||
extern void setRotarySwDisplay(int8_t idx);
|
||||
extern void animRotarySw(uint8_t x);
|
||||
extern void menuProcRotarySwitches(uint8_t event);
|
||||
|
||||
|
||||
// Control mode define from arducoper
|
||||
enum CONTROL_MODE {
|
||||
|
||||
+1
-1
@@ -164,7 +164,7 @@ void *main_thread(void *)
|
||||
|
||||
g_menuStackPtr = 0;
|
||||
g_menuStack[0] = menuMainView;
|
||||
g_menuStack[1] = menuProcModelSelect;
|
||||
g_menuStack[1] = menuModelSelect;
|
||||
|
||||
#ifdef PCBSKY9X
|
||||
eeprom_init();
|
||||
|
||||
+143
-253
@@ -161,10 +161,6 @@ extern uint16_t Sine_values[];
|
||||
|
||||
#define CODEC_ID_PCM_S16LE 1
|
||||
#define CODEC_ID_PCM_ALAW 6
|
||||
uint8_t pcmCodec;
|
||||
uint32_t pcmFreq = 8000;
|
||||
uint8_t backgroundCodec;
|
||||
uint32_t backgroundFreq = 8000;
|
||||
|
||||
#ifndef SIMU
|
||||
void audioTask(void* pdata)
|
||||
@@ -189,128 +185,127 @@ uint16_t wavSamplesArray[3*WAV_BUFFER_SIZE];
|
||||
uint16_t * wavSamplesBuffer = &wavSamplesArray[0];
|
||||
uint16_t * nextAudioData = NULL;
|
||||
uint16_t nextAudioSize = 0;
|
||||
bool playingBackground = false;
|
||||
|
||||
#if defined(SDCARD) && !defined(SIMU)
|
||||
void AudioQueue::sdWakeup(AudioContext & context)
|
||||
{
|
||||
if (!nextAudioData) {
|
||||
AudioFragment & fragment = context.fragment;
|
||||
FRESULT result = FR_OK;
|
||||
UINT read = 0;
|
||||
if (fragment.file[1]) {
|
||||
result = f_open(&context.wavFile, fragment.file, FA_OPEN_EXISTING | FA_READ);
|
||||
fragment.file[1] = 0;
|
||||
if (result == FR_OK) {
|
||||
result = f_read(&context.wavFile, (uint8_t *)wavSamplesBuffer, WAV_HEADER_SIZE, &read);
|
||||
if (result == FR_OK && read == WAV_HEADER_SIZE && !memcmp(wavSamplesBuffer, "RIFF", 4)) {
|
||||
context.pcmCodec = wavSamplesBuffer[10];
|
||||
context.pcmFreq = wavSamplesBuffer[12];
|
||||
if (context.pcmCodec != CODEC_ID_PCM_S16LE) {
|
||||
result = f_read(&context.wavFile, (uint8_t *)wavSamplesBuffer, 12, &read);
|
||||
}
|
||||
}
|
||||
else {
|
||||
result = FR_DENIED;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
read = 0;
|
||||
uint16_t bufsize = (context.pcmCodec == CODEC_ID_PCM_S16LE ? WAV_BUFFER_SIZE * sizeof(uint16_t) : WAV_BUFFER_SIZE);
|
||||
if (result == FR_OK) {
|
||||
result = f_read(&context.wavFile, (uint8_t *)wavSamplesBuffer, bufsize, &read);
|
||||
}
|
||||
|
||||
if (result != FR_OK) {
|
||||
toneStop();
|
||||
memset(&fragment, 0, sizeof(fragment));
|
||||
f_close(&context.wavFile);
|
||||
CoSetTmrCnt(audioTimer, (WAV_BUFFER_SIZE * 1000) / context.pcmFreq, 0);
|
||||
CoStartTmr(audioTimer);
|
||||
CoClearFlag(audioFlag);
|
||||
state = AUDIO_RESUMING;
|
||||
}
|
||||
else {
|
||||
if (read != bufsize) {
|
||||
memset(&fragment, 0, sizeof(fragment));
|
||||
f_close(&context.wavFile);
|
||||
}
|
||||
|
||||
setFrequency(context.pcmFreq);
|
||||
|
||||
if (context.pcmCodec == CODEC_ID_PCM_S16LE) {
|
||||
read /= 2;
|
||||
uint32_t i = 0;
|
||||
for (; i < read; i++)
|
||||
wavSamplesBuffer[i] = ((uint16_t) 0x8000 + ((int16_t) (wavSamplesBuffer[i]))) >> 4;
|
||||
for (; i < WAV_BUFFER_SIZE; i++)
|
||||
wavSamplesBuffer[i] = 0x8000;
|
||||
}
|
||||
else if (context.pcmCodec == CODEC_ID_PCM_ALAW) {
|
||||
int32_t i;
|
||||
for (i = read - 1; i >= 0; i--)
|
||||
wavSamplesBuffer[i] = alawTable[((uint8_t *) wavSamplesBuffer)[i]];
|
||||
for (i = read; i < WAV_BUFFER_SIZE; i++)
|
||||
wavSamplesBuffer[i] = 0x8000;
|
||||
}
|
||||
|
||||
read /= 2;
|
||||
register Dacc *dacptr = DACC;
|
||||
|
||||
if (read) {
|
||||
state = AUDIO_PLAYING_WAV;
|
||||
|
||||
if (dacptr->DACC_ISR & DACC_ISR_TXBUFE) {
|
||||
dacptr->DACC_TPR = CONVERT_PTR(wavSamplesBuffer);
|
||||
dacptr->DACC_TCR = read;
|
||||
CoSetFlag(audioFlag);
|
||||
}
|
||||
else if (dacptr->DACC_TNCR == 0) {
|
||||
dacptr->DACC_TNPR = CONVERT_PTR(wavSamplesBuffer);
|
||||
dacptr->DACC_TNCR = read;
|
||||
CoSetFlag(audioFlag);
|
||||
}
|
||||
else {
|
||||
nextAudioSize = read;
|
||||
nextAudioData = wavSamplesBuffer;
|
||||
toneStart();
|
||||
CoSetTmrCnt(audioTimer, (WAV_BUFFER_SIZE * 500) / context.pcmFreq, 0);
|
||||
CoStartTmr(audioTimer);
|
||||
}
|
||||
|
||||
wavSamplesBuffer += WAV_BUFFER_SIZE;
|
||||
if (wavSamplesBuffer >= wavSamplesArray + 3 * WAV_BUFFER_SIZE)
|
||||
wavSamplesBuffer = wavSamplesArray;
|
||||
}
|
||||
else {
|
||||
state = AUDIO_RESUMING;
|
||||
CoSetFlag(audioFlag);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
CoSetTmrCnt(audioTimer, 5/*10ms*/, 0);
|
||||
CoStartTmr(audioTimer);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void AudioQueue::wakeup()
|
||||
{
|
||||
#if defined(SDCARD) && !defined(SIMU)
|
||||
static FIL wavFile;
|
||||
static FIL backgroundFile;
|
||||
#endif
|
||||
|
||||
bool lv_playingBackground = false;
|
||||
AudioFragment & fragment = currentContext.fragment;
|
||||
|
||||
if (prioIdx >= 0) {
|
||||
memset(¤t, 0, sizeof(current));
|
||||
background.duration = 0;
|
||||
memset(&fragment, 0, sizeof(fragment));
|
||||
}
|
||||
|
||||
#if defined(SDCARD) && !defined(SIMU)
|
||||
if (current.file[0]) {
|
||||
if (!nextAudioData || DACC->DACC_ISR & DACC_ISR_TXBUFE) {
|
||||
FRESULT result = FR_OK;
|
||||
UINT read = 0;
|
||||
if (current.file[1]) {
|
||||
result = f_open(&wavFile, current.file, FA_OPEN_EXISTING | FA_READ);
|
||||
current.file[1] = 0;
|
||||
if (result == FR_OK) {
|
||||
result = f_read(&wavFile, (uint8_t *) wavSamplesBuffer,
|
||||
WAV_HEADER_SIZE, &read);
|
||||
if (result == FR_OK && read == WAV_HEADER_SIZE
|
||||
&& !memcmp(wavSamplesBuffer, "RIFF", 4)) {
|
||||
pcmCodec = wavSamplesBuffer[10];
|
||||
pcmFreq = wavSamplesBuffer[12];
|
||||
if (pcmCodec != CODEC_ID_PCM_S16LE) {
|
||||
result = f_read(&wavFile, (uint8_t *) wavSamplesBuffer, 12,
|
||||
&read);
|
||||
}
|
||||
setFrequency(pcmFreq);
|
||||
}
|
||||
else {
|
||||
result = FR_DENIED;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
read = 0;
|
||||
uint16_t bufsize = (pcmCodec == CODEC_ID_PCM_S16LE ? WAV_BUFFER_SIZE * sizeof(uint16_t) : WAV_BUFFER_SIZE);
|
||||
if (result == FR_OK) {
|
||||
result = f_read(&wavFile, (uint8_t *) wavSamplesBuffer, bufsize, &read);
|
||||
}
|
||||
|
||||
if (result != FR_OK) {
|
||||
toneStop();
|
||||
current.file[0] = 0;
|
||||
f_close(&wavFile);
|
||||
CoSetTmrCnt(audioTimer, (WAV_BUFFER_SIZE * 1000) / pcmFreq, 0);
|
||||
CoClearFlag(audioFlag);
|
||||
CoStartTmr(audioTimer);
|
||||
state = AUDIO_RESUMING;
|
||||
}
|
||||
else {
|
||||
if (read != bufsize) {
|
||||
current.file[0] = 0;
|
||||
f_close(&wavFile);
|
||||
}
|
||||
|
||||
if (pcmCodec == CODEC_ID_PCM_S16LE) {
|
||||
read /= 2;
|
||||
uint32_t i = 0;
|
||||
for (; i < read; i++)
|
||||
wavSamplesBuffer[i] = ((uint16_t) 0x8000 + ((int16_t) (wavSamplesBuffer[i]))) >> 4;
|
||||
for (; i < WAV_BUFFER_SIZE; i++)
|
||||
wavSamplesBuffer[i] = 0x8000;
|
||||
}
|
||||
else if (pcmCodec == CODEC_ID_PCM_ALAW) {
|
||||
int32_t i;
|
||||
for (i = read - 1; i >= 0; i--)
|
||||
wavSamplesBuffer[i] = alawTable[((uint8_t *) wavSamplesBuffer)[i]];
|
||||
for (i = read; i < WAV_BUFFER_SIZE; i++)
|
||||
wavSamplesBuffer[i] = 0x8000;
|
||||
}
|
||||
|
||||
read /= 2;
|
||||
register Dacc *dacptr = DACC;
|
||||
|
||||
if (read) {
|
||||
state = AUDIO_PLAYING_WAV;
|
||||
if (dacptr->DACC_ISR & DACC_ISR_TXBUFE) {
|
||||
dacptr->DACC_TPR = CONVERT_PTR(wavSamplesBuffer);
|
||||
dacptr->DACC_TCR = read;
|
||||
nextAudioData = NULL;
|
||||
CoSetFlag(audioFlag);
|
||||
}
|
||||
else if (dacptr->DACC_TNCR == 0) {
|
||||
dacptr->DACC_TNPR = CONVERT_PTR(wavSamplesBuffer);
|
||||
dacptr->DACC_TNCR = read;
|
||||
nextAudioData = NULL;
|
||||
CoSetFlag(audioFlag);
|
||||
}
|
||||
else {
|
||||
nextAudioSize = read;
|
||||
nextAudioData = wavSamplesBuffer;
|
||||
toneStart();
|
||||
CoSetTmrCnt(audioTimer, (WAV_BUFFER_SIZE * 500) / pcmFreq, 0);
|
||||
CoStartTmr(audioTimer);
|
||||
}
|
||||
|
||||
wavSamplesBuffer += WAV_BUFFER_SIZE;
|
||||
if (wavSamplesBuffer >= wavSamplesArray + 3 * WAV_BUFFER_SIZE)
|
||||
wavSamplesBuffer = wavSamplesArray;
|
||||
}
|
||||
else {
|
||||
CoSetFlag(audioFlag);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
CoSetTmrCnt(audioTimer, 5/*10ms*/, 0);
|
||||
CoStartTmr(audioTimer);
|
||||
}
|
||||
if (fragment.file[0]) {
|
||||
sdWakeup(currentContext);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
if (current.duration > 0) {
|
||||
if (fragment.duration > 0) {
|
||||
if (state != AUDIO_PLAYING_TONE) {
|
||||
state = AUDIO_PLAYING_TONE;
|
||||
|
||||
@@ -321,30 +316,35 @@ void AudioQueue::wakeup()
|
||||
dacptr->DACC_TNCR = 50 ; // words, 100 16 bit values
|
||||
}
|
||||
|
||||
setFrequency(current.freq * 6100 / 4);
|
||||
setFrequency(fragment.freq * 6100 / 4);
|
||||
|
||||
if (current.freqIncr) {
|
||||
if (fragment.freqIncr) {
|
||||
CoSetTmrCnt(audioTimer, 2, 0);
|
||||
current.freq += current.freqIncr;
|
||||
current.duration--;
|
||||
fragment.freq += fragment.freqIncr;
|
||||
fragment.duration--;
|
||||
}
|
||||
else {
|
||||
CoSetTmrCnt(audioTimer, current.duration*2, 0);
|
||||
current.duration = 0;
|
||||
CoSetTmrCnt(audioTimer, fragment.duration*2, 0);
|
||||
fragment.duration = 0;
|
||||
}
|
||||
toneStart();
|
||||
CoClearFlag(audioFlag);
|
||||
CoStartTmr(audioTimer);
|
||||
}
|
||||
else if (current.pause > 0) {
|
||||
else if (fragment.pause > 0) {
|
||||
state = AUDIO_PLAYING_TONE;
|
||||
CoSetTmrCnt(audioTimer, current.pause*2, 0);
|
||||
current.pause = 0;
|
||||
CoSetTmrCnt(audioTimer, fragment.pause*2, 0);
|
||||
fragment.pause = 0;
|
||||
toneStop();
|
||||
CoClearFlag(audioFlag);
|
||||
CoStartTmr(audioTimer);
|
||||
}
|
||||
else if (ridx == widx && prioIdx < 0 && background.duration > 0) {
|
||||
#if defined(SDCARD) && !defined(SIMU)
|
||||
else if (ridx == widx && prioIdx < 0 && backgroundContext.fragment.file[0]) {
|
||||
sdWakeup(backgroundContext);
|
||||
}
|
||||
#endif
|
||||
else if (ridx == widx && prioIdx < 0 && backgroundContext.fragment.duration > 0) {
|
||||
if (state != AUDIO_PLAYING_TONE) {
|
||||
state = AUDIO_PLAYING_TONE;
|
||||
register Dacc *dacptr = DACC;
|
||||
@@ -353,120 +353,13 @@ void AudioQueue::wakeup()
|
||||
dacptr->DACC_TCR = 50 ; // words, 100 16 bit values
|
||||
dacptr->DACC_TNCR = 50 ; // words, 100 16 bit values
|
||||
}
|
||||
CoSetTmrCnt(audioTimer, background.duration*2, 0);
|
||||
background.duration = 0;
|
||||
setFrequency(background.freq * 6100 / 4);
|
||||
CoSetTmrCnt(audioTimer, backgroundContext.fragment.duration*2, 0);
|
||||
backgroundContext.fragment.duration = 0;
|
||||
setFrequency(backgroundContext.fragment.freq * 6100 / 4);
|
||||
toneStart();
|
||||
CoClearFlag(audioFlag);
|
||||
CoStartTmr(audioTimer);
|
||||
}
|
||||
#if defined(SDCARD) && !defined(SIMU)
|
||||
else if (ridx == widx && prioIdx < 0 && background.file[0]) {
|
||||
if (!nextAudioData || DACC->DACC_ISR & DACC_ISR_TXBUFE) {
|
||||
FRESULT result = FR_OK;
|
||||
UINT read = 0;
|
||||
if (background.file[1]) {
|
||||
f_close(&backgroundFile);
|
||||
result = f_open(&backgroundFile, background.file, FA_OPEN_EXISTING | FA_READ);
|
||||
background.file[1] = 0;
|
||||
if (result == FR_OK) {
|
||||
result = f_read(&backgroundFile, (uint8_t *)wavSamplesBuffer, WAV_HEADER_SIZE, &read);
|
||||
if (result == FR_OK && read == WAV_HEADER_SIZE && !memcmp(wavSamplesBuffer, "RIFF", 4)) {
|
||||
backgroundCodec = wavSamplesBuffer[10];
|
||||
backgroundFreq = wavSamplesBuffer[12];
|
||||
if (backgroundCodec != CODEC_ID_PCM_S16LE) {
|
||||
result = f_read(&backgroundFile, (uint8_t *)wavSamplesBuffer, 12, &read);
|
||||
}
|
||||
setFrequency(backgroundFreq);
|
||||
}
|
||||
else {
|
||||
result = FR_DENIED;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (!playingBackground) {
|
||||
setFrequency(backgroundFreq);
|
||||
}
|
||||
|
||||
lv_playingBackground = true;
|
||||
|
||||
read = 0;
|
||||
uint16_t bufsize = (backgroundCodec == CODEC_ID_PCM_S16LE ? WAV_BUFFER_SIZE * sizeof(uint16_t) : WAV_BUFFER_SIZE);
|
||||
if (result == FR_OK) {
|
||||
result = f_read(&backgroundFile, (uint8_t *)wavSamplesBuffer, bufsize, &read);
|
||||
}
|
||||
|
||||
if (result != FR_OK) {
|
||||
toneStop();
|
||||
background.file[0] = 0;
|
||||
f_close(&backgroundFile);
|
||||
CoSetTmrCnt(audioTimer, (WAV_BUFFER_SIZE * 1000) / backgroundFreq, 0);
|
||||
CoClearFlag(audioFlag);
|
||||
CoStartTmr(audioTimer);
|
||||
state = AUDIO_RESUMING;
|
||||
}
|
||||
else {
|
||||
if (read != bufsize) {
|
||||
background.file[0] = 0;
|
||||
f_close(&backgroundFile);
|
||||
}
|
||||
|
||||
if (backgroundCodec == CODEC_ID_PCM_S16LE) {
|
||||
read /= 2;
|
||||
uint32_t i = 0;
|
||||
for (; i < read; i++)
|
||||
wavSamplesBuffer[i] = ((uint16_t) 0x8000 + ((int16_t) (wavSamplesBuffer[i]))) >> 4;
|
||||
for (; i < WAV_BUFFER_SIZE; i++)
|
||||
wavSamplesBuffer[i] = 0x8000;
|
||||
}
|
||||
else if (backgroundCodec == CODEC_ID_PCM_ALAW) {
|
||||
int32_t i;
|
||||
for (i = read - 1; i >= 0; i--)
|
||||
wavSamplesBuffer[i] = alawTable[((uint8_t *) wavSamplesBuffer)[i]];
|
||||
for (i = read; i < WAV_BUFFER_SIZE; i++)
|
||||
wavSamplesBuffer[i] = 0x8000;
|
||||
}
|
||||
|
||||
read /= 2;
|
||||
register Dacc *dacptr = DACC;
|
||||
|
||||
if (read) {
|
||||
state = AUDIO_PLAYING_WAV;
|
||||
if (dacptr->DACC_ISR & DACC_ISR_TXBUFE) {
|
||||
dacptr->DACC_TPR = CONVERT_PTR(wavSamplesBuffer);
|
||||
dacptr->DACC_TCR = read;
|
||||
nextAudioData = NULL;
|
||||
CoSetFlag(audioFlag);
|
||||
}
|
||||
else if (dacptr->DACC_TNCR == 0) {
|
||||
dacptr->DACC_TNPR = CONVERT_PTR(wavSamplesBuffer);
|
||||
dacptr->DACC_TNCR = read;
|
||||
nextAudioData = NULL;
|
||||
CoSetFlag(audioFlag);
|
||||
}
|
||||
else {
|
||||
nextAudioSize = read;
|
||||
nextAudioData = wavSamplesBuffer;
|
||||
toneStart();
|
||||
CoSetTmrCnt(audioTimer, (WAV_BUFFER_SIZE * 500) / pcmFreq, 0);
|
||||
CoStartTmr(audioTimer);
|
||||
}
|
||||
|
||||
wavSamplesBuffer += WAV_BUFFER_SIZE;
|
||||
if (wavSamplesBuffer >= wavSamplesArray + 3 * WAV_BUFFER_SIZE)
|
||||
wavSamplesBuffer = wavSamplesArray;
|
||||
}
|
||||
else {
|
||||
CoSetFlag(audioFlag);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
CoSetTmrCnt(audioTimer, 5/*10ms*/, 0);
|
||||
CoStartTmr(audioTimer);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
else {
|
||||
CoEnterMutexSection(audioMutex);
|
||||
|
||||
@@ -477,10 +370,9 @@ void AudioQueue::wakeup()
|
||||
toneStop();
|
||||
CoClearFlag(audioFlag);
|
||||
nextAudioData = NULL;
|
||||
memset(¤t, 0, sizeof(current));
|
||||
if (state == AUDIO_PLAYING_WAV) {
|
||||
state = AUDIO_RESUMING;
|
||||
CoSetTmrCnt(audioTimer, 1/*2ms*/ + (WAV_BUFFER_SIZE * 1000) / pcmFreq, 0);
|
||||
CoSetTmrCnt(audioTimer, 1/*2ms*/ + (WAV_BUFFER_SIZE * 1000) / getFrequency(), 0);
|
||||
CoStartTmr(audioTimer);
|
||||
}
|
||||
else if (state == AUDIO_PLAYING_TONE) {
|
||||
@@ -496,20 +388,19 @@ void AudioQueue::wakeup()
|
||||
CoSetFlag(audioFlag);
|
||||
}
|
||||
|
||||
memcpy(¤t, &fragments[ridx], sizeof(current));
|
||||
memcpy(&fragment, &fragments[ridx], sizeof(fragment));
|
||||
if (!fragments[ridx].repeat--) {
|
||||
ridx = (ridx + 1) % AUDIO_QUEUE_LENGTH;
|
||||
}
|
||||
}
|
||||
else {
|
||||
memset(&fragment, 0, sizeof(fragment));
|
||||
state = AUDIO_SLEEPING;
|
||||
toneStop();
|
||||
}
|
||||
|
||||
CoLeaveMutexSection(audioMutex);
|
||||
}
|
||||
|
||||
playingBackground = lv_playingBackground;
|
||||
}
|
||||
|
||||
inline uint8_t getToneLength(uint8_t tLen)
|
||||
@@ -531,6 +422,9 @@ void AudioQueue::pause(uint8_t tLen)
|
||||
|
||||
bool AudioQueue::isPlaying(uint8_t id)
|
||||
{
|
||||
if (currentContext.fragment.id == id || backgroundContext.fragment.id == id)
|
||||
return true;
|
||||
|
||||
uint8_t i = ridx;
|
||||
while (i != widx) {
|
||||
AudioFragment & fragment = fragments[i];
|
||||
@@ -538,10 +432,6 @@ bool AudioQueue::isPlaying(uint8_t id)
|
||||
return true;
|
||||
i = (i + 1) % AUDIO_QUEUE_LENGTH;
|
||||
}
|
||||
|
||||
if (background.id == id)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -554,9 +444,9 @@ void AudioQueue::play(uint8_t tFreq, uint8_t tLen, uint8_t tPause, uint8_t tFlag
|
||||
CoEnterMutexSection(audioMutex);
|
||||
|
||||
if (tFlags & PLAY_BACKGROUND) {
|
||||
background.freq = tFreq * 2;
|
||||
background.duration = tLen;
|
||||
background.pause = tPause;
|
||||
backgroundContext.fragment.freq = tFreq * 2;
|
||||
backgroundContext.fragment.duration = tLen;
|
||||
backgroundContext.fragment.pause = tPause;
|
||||
if (!busy()) {
|
||||
state = AUDIO_RESUMING;
|
||||
CoSetFlag(audioFlag);
|
||||
@@ -602,9 +492,9 @@ void AudioQueue::playFile(const char *filename, uint8_t flags, uint8_t id)
|
||||
CoEnterMutexSection(audioMutex);
|
||||
|
||||
if (flags & PLAY_BACKGROUND) {
|
||||
memset(&background, 0, sizeof(background));
|
||||
strcpy(background.file, filename); // TODO strncpy
|
||||
background.id = id;
|
||||
memset(&backgroundContext.fragment, 0, sizeof(AudioFragment));
|
||||
strcpy(backgroundContext.fragment.file, filename); // TODO strncpy
|
||||
backgroundContext.fragment.id = id;
|
||||
if (!busy()) {
|
||||
state = AUDIO_RESUMING;
|
||||
CoSetFlag(audioFlag);
|
||||
@@ -635,8 +525,8 @@ void AudioQueue::playFile(const char *filename, uint8_t flags, uint8_t id)
|
||||
void AudioQueue::stopPlay(uint8_t id)
|
||||
{
|
||||
// For the moment it's only needed to stop the background music
|
||||
if (background.id == id) {
|
||||
memset(&background, 0, sizeof(background));
|
||||
if (backgroundContext.fragment.id == id) {
|
||||
memset(&backgroundContext.fragment, 0, sizeof(AudioFragment));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -674,7 +564,7 @@ void audioEvent(uint8_t e, uint8_t f)
|
||||
}
|
||||
else
|
||||
#endif
|
||||
if (e < AU_FRSKY_FIRST || !audioQueue.busy()) {
|
||||
if (e < AU_FRSKY_FIRST || audioQueue.empty()) {
|
||||
switch (e) {
|
||||
// inactivity timer alert
|
||||
case AU_INACTIVITY:
|
||||
|
||||
+23
-4
@@ -34,6 +34,8 @@
|
||||
#ifndef audio_h
|
||||
#define audio_h
|
||||
|
||||
#include "../FatFs/ff.h"
|
||||
|
||||
#define AUDIO_QUEUE_LENGTH (20)
|
||||
#define BEEP_DEFAULT_FREQ (70)
|
||||
#define BEEP_OFFSET (10)
|
||||
@@ -64,6 +66,16 @@ extern "C" void DAC_IRQHandler();
|
||||
|
||||
extern bool playingBackground;
|
||||
|
||||
class AudioContext {
|
||||
public:
|
||||
AudioFragment fragment;
|
||||
#if defined(SDCARD)
|
||||
FIL wavFile;
|
||||
#endif
|
||||
uint8_t pcmCodec;
|
||||
uint32_t pcmFreq;
|
||||
};
|
||||
|
||||
class AudioQueue {
|
||||
|
||||
friend void audioTask(void* pdata);
|
||||
@@ -90,23 +102,30 @@ class AudioQueue {
|
||||
#ifdef SIMU
|
||||
return false;
|
||||
#else
|
||||
return (state != AUDIO_SLEEPING && !playingBackground);
|
||||
return (state != AUDIO_SLEEPING);
|
||||
#endif
|
||||
}
|
||||
|
||||
bool empty()
|
||||
{
|
||||
return ridx == widx;
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
void wakeup();
|
||||
|
||||
void sdWakeup(AudioContext & context);
|
||||
|
||||
uint8_t state;
|
||||
uint8_t ridx;
|
||||
uint8_t widx;
|
||||
int8_t prioIdx;
|
||||
|
||||
AudioFragment fragments[AUDIO_QUEUE_LENGTH];
|
||||
AudioFragment background; // for background music / vario
|
||||
|
||||
AudioFragment current;
|
||||
|
||||
AudioContext currentContext;
|
||||
AudioContext backgroundContext; // for background music / vario
|
||||
};
|
||||
|
||||
extern AudioQueue audioQueue;
|
||||
|
||||
+28
-14
@@ -101,22 +101,33 @@ void buzzer_sound( uint8_t time )
|
||||
Buzzer_count = time ;
|
||||
}
|
||||
|
||||
void setFrequency( uint32_t frequency )
|
||||
uint32_t currentFrequency = 0;
|
||||
|
||||
uint32_t getFrequency()
|
||||
{
|
||||
register Tc *ptc ;
|
||||
register uint32_t timer ;
|
||||
return currentFrequency;
|
||||
}
|
||||
|
||||
timer = Master_frequency / (8 * frequency) ; // MCK/8 and 100 000 Hz
|
||||
if (timer > 65535)
|
||||
timer = 65535 ;
|
||||
if (timer < 2)
|
||||
timer = 2 ;
|
||||
void setFrequency(uint32_t frequency)
|
||||
{
|
||||
if (currentFrequency != frequency) {
|
||||
currentFrequency = frequency;
|
||||
|
||||
ptc = TC0 ; // Tc block 0 (TC0-2)
|
||||
ptc->TC_CHANNEL[1].TC_CCR = TC_CCR0_CLKDIS ; // Stop clock
|
||||
ptc->TC_CHANNEL[1].TC_RC = timer ; // 100 000 Hz
|
||||
ptc->TC_CHANNEL[1].TC_RA = timer >> 1 ;
|
||||
ptc->TC_CHANNEL[1].TC_CCR = 5 ; // Enable clock and trigger it (may only need trigger)
|
||||
register Tc *ptc ;
|
||||
register uint32_t timer ;
|
||||
|
||||
timer = Master_frequency / (8 * frequency) ; // MCK/8 and 100 000 Hz
|
||||
if (timer > 65535)
|
||||
timer = 65535 ;
|
||||
if (timer < 2)
|
||||
timer = 2 ;
|
||||
|
||||
ptc = TC0 ; // Tc block 0 (TC0-2)
|
||||
ptc->TC_CHANNEL[1].TC_CCR = TC_CCR0_CLKDIS ; // Stop clock
|
||||
ptc->TC_CHANNEL[1].TC_RC = timer ; // 100 000 Hz
|
||||
ptc->TC_CHANNEL[1].TC_RA = timer >> 1 ;
|
||||
ptc->TC_CHANNEL[1].TC_CCR = 5 ; // Enable clock and trigger it (may only need trigger)
|
||||
}
|
||||
}
|
||||
|
||||
// Start TIMER1 at 100000Hz, used for DACC trigger
|
||||
@@ -184,10 +195,13 @@ extern "C" void DAC_IRQHandler()
|
||||
toneStop();
|
||||
}
|
||||
}
|
||||
else {
|
||||
else if (audioQueue.state == AUDIO_PLAYING_TONE){
|
||||
DACC->DACC_TNPR = CONVERT_PTR(Sine_values);
|
||||
DACC->DACC_TNCR = 50 ; // words, 100 16 bit values
|
||||
}
|
||||
else {
|
||||
toneStop();
|
||||
}
|
||||
}
|
||||
|
||||
void end_sound()
|
||||
|
||||
@@ -42,6 +42,7 @@ extern void buzzer_on( void ) ;
|
||||
extern void buzzer_off( void ) ;
|
||||
extern void buzzer_sound( uint8_t time ) ;
|
||||
extern void setFrequency( uint32_t frequency ) ;
|
||||
extern uint32_t getFrequency();
|
||||
extern void start_timer1( void ) ;
|
||||
extern void initDac( void ) ;
|
||||
extern void end_sound( void ) ;
|
||||
|
||||
@@ -33,13 +33,13 @@
|
||||
|
||||
#include "open9x.h"
|
||||
|
||||
void menuProcStatistic(uint8_t event)
|
||||
void menuStatisticsView(uint8_t event)
|
||||
{
|
||||
TITLE(STR_MENUSTAT);
|
||||
switch(event)
|
||||
{
|
||||
case EVT_KEY_FIRST(KEY_UP):
|
||||
chainMenu(menuProcDebug);
|
||||
chainMenu(menuStatisticsDebug);
|
||||
break;
|
||||
case EVT_KEY_FIRST(KEY_DOWN):
|
||||
case EVT_KEY_FIRST(KEY_EXIT):
|
||||
@@ -84,7 +84,7 @@ void menuProcStatistic(uint8_t event)
|
||||
#else
|
||||
#define MENU_DEBUG_COL_OFS (14*FW)
|
||||
#endif
|
||||
void menuProcDebug(uint8_t event)
|
||||
void menuStatisticsDebug(uint8_t event)
|
||||
{
|
||||
TITLE(STR_MENUDEBUG);
|
||||
switch(event)
|
||||
@@ -109,7 +109,7 @@ void menuProcDebug(uint8_t event)
|
||||
AUDIO_KEYPAD_UP();
|
||||
break;
|
||||
case EVT_KEY_FIRST(KEY_DOWN):
|
||||
chainMenu(menuProcStatistic);
|
||||
chainMenu(menuStatisticsView);
|
||||
break;
|
||||
case EVT_KEY_FIRST(KEY_UP):
|
||||
case EVT_KEY_FIRST(KEY_EXIT):
|
||||
|
||||
Reference in New Issue
Block a user