fix(fw): compilation without AUDIO (#5022)

This commit is contained in:
Raphael Coeffic
2024-05-18 14:11:20 +10:00
committed by GitHub
parent c2e7d91539
commit 6a59c580ef
14 changed files with 75 additions and 10 deletions
+32 -4
View File
@@ -566,9 +566,6 @@ void audioTask(void * pdata);
#define AUDIO_BUZZER(a, b) b #define AUDIO_BUZZER(a, b) b
#endif #endif
#define AUDIO_ERROR_MESSAGE(e) audioEvent(e)
#define AUDIO_TIMER_MINUTE(t) playDuration(t, 0, 0)
void onKeyError(); void onKeyError();
void audioKeyPress(); void audioKeyPress();
@@ -576,6 +573,11 @@ void audioKeyError();
void audioTrimPress(int value); void audioTrimPress(int value);
void audioTimerCountdown(uint8_t timer, int value); void audioTimerCountdown(uint8_t timer, int value);
#if defined(AUDIO)
#define AUDIO_ERROR_MESSAGE(e) audioEvent(e)
#define AUDIO_TIMER_MINUTE(t) playDuration(t, 0, 0)
#define AUDIO_KEY_PRESS() audioKeyPress() #define AUDIO_KEY_PRESS() audioKeyPress()
#define AUDIO_KEY_ERROR() audioKeyError() #define AUDIO_KEY_ERROR() audioKeyError()
@@ -606,6 +608,28 @@ void audioTimerCountdown(uint8_t timer, int value);
#define AUDIO_TRAINER_LOST() audioEvent(AU_TRAINER_LOST) #define AUDIO_TRAINER_LOST() audioEvent(AU_TRAINER_LOST)
#define AUDIO_TRAINER_BACK() audioEvent(AU_TRAINER_BACK) #define AUDIO_TRAINER_BACK() audioEvent(AU_TRAINER_BACK)
#else // AUDIO
#include "buzzer.h"
#define AUDIO_TIMER_COUNTDOWN(idx, val)
#define AUDIO_TIMER_ELAPSED(idx)
#define AUDIO_TRIM_MIN()
#define AUDIO_TRIM_MAX()
#define AUDIO_TRIM_PRESS(val)
#define AUDIO_VARIO(fq, t, p, f)
#define AUDIO_RSSI_ORANGE()
#define AUDIO_RSSI_RED()
#define AUDIO_RAS_RED()
#define AUDIO_TELEMETRY_CONNECTED()
#define AUDIO_TELEMETRY_LOST()
#define AUDIO_TELEMETRY_BACK()
#define AUDIO_TRAINER_CONNECTED()
#define AUDIO_TRAINER_LOST()
#define AUDIO_TRAINER_BACK()
#endif
enum AutomaticPromptsCategories { enum AutomaticPromptsCategories {
SYSTEM_AUDIO_CATEGORY, SYSTEM_AUDIO_CATEGORY,
MODEL_AUDIO_CATEGORY, MODEL_AUDIO_CATEGORY,
@@ -639,10 +663,13 @@ void playModelName();
#define PLAY_VALUE(v, id) playValue((v), (id), USE_SETTINGS_VOLUME) #define PLAY_VALUE(v, id) playValue((v), (id), USE_SETTINGS_VOLUME)
#define PLAY_FILE(f, flags, id) audioQueue.playFile((f), (flags), (id), USE_SETTINGS_VOLUME) #define PLAY_FILE(f, flags, id) audioQueue.playFile((f), (flags), (id), USE_SETTINGS_VOLUME)
#define STOP_PLAY(id) audioQueue.stopPlay((id)) #define STOP_PLAY(id) audioQueue.stopPlay((id))
#if defined(AUDIO)
#define AUDIO_RESET() audioQueue.stopAll() #define AUDIO_RESET() audioQueue.stopAll()
#define AUDIO_FLUSH() audioQueue.flush() #define AUDIO_FLUSH() audioQueue.flush()
#endif
#if defined(SDCARD) #if defined(SDCARD) & defined(AUDIO)
extern tmr10ms_t timeAutomaticPromptsSilence; extern tmr10ms_t timeAutomaticPromptsSilence;
void playModelEvent(uint8_t category, uint8_t index, event_t event=0); void playModelEvent(uint8_t category, uint8_t index, event_t event=0);
#define PLAY_PHASE_OFF(phase) playModelEvent(PHASE_AUDIO_CATEGORY, phase, AUDIO_EVENT_OFF) #define PLAY_PHASE_OFF(phase) playModelEvent(PHASE_AUDIO_CATEGORY, phase, AUDIO_EVENT_OFF)
@@ -661,6 +688,7 @@ void playModelName();
#define PLAY_LOGICAL_SWITCH_ON(sw) #define PLAY_LOGICAL_SWITCH_ON(sw)
#define PLAY_MODEL_NAME() #define PLAY_MODEL_NAME()
#define START_SILENCE_PERIOD() #define START_SILENCE_PERIOD()
#define IS_SILENCE_PERIOD_ELAPSED() true
#endif #endif
char * getAudioPath(char * path); char * getAudioPath(char * path);
+2 -2
View File
@@ -70,7 +70,7 @@ inline void beep(uint8_t) { }
#define AUDIO_WARNING1() beep(3) #define AUDIO_WARNING1() beep(3)
#define AUDIO_ERROR() beep(4) #define AUDIO_ERROR() beep(4)
#define AUDIO_MIX_WARNING(x) beep(1) #define AUDIO_MIX_WARNING(x) beep(1)
#define AUDIO_POT_MIDDLE() beep(2) #define AUDIO_POT_MIDDLE(x) beep(2)
#define AUDIO_TIMER_COUNTDOWN(idx, val) beep(2) #define AUDIO_TIMER_COUNTDOWN(idx, val) beep(2)
#define AUDIO_TIMER_ELAPSED(idx) beep(3) #define AUDIO_TIMER_ELAPSED(idx) beep(3)
#define AUDIO_VARIO_UP() _beep(1) #define AUDIO_VARIO_UP() _beep(1)
@@ -95,7 +95,7 @@ inline void beep(uint8_t) { }
#define AUDIO_WARNING1() #define AUDIO_WARNING1()
#define AUDIO_ERROR() #define AUDIO_ERROR()
#define AUDIO_MIX_WARNING(x) #define AUDIO_MIX_WARNING(x)
#define AUDIO_POT_MIDDLE() #define AUDIO_POT_MIDDLE(x)
#define AUDIO_TIMER_LT10(m, x) #define AUDIO_TIMER_LT10(m, x)
#define AUDIO_TIMER_00(m) #define AUDIO_TIMER_00(m)
#define AUDIO_VARIO_UP() #define AUDIO_VARIO_UP()
+4
View File
@@ -858,8 +858,12 @@ int cliStackInfo(const char ** argv)
cliSerialPrint("[MAIN] %d available / %d bytes", mainStackAvailable()*4, stackSize()*4); cliSerialPrint("[MAIN] %d available / %d bytes", mainStackAvailable()*4, stackSize()*4);
cliSerialPrint("[MENUS] %d available / %d bytes", menusStack.available()*4, menusStack.size()); cliSerialPrint("[MENUS] %d available / %d bytes", menusStack.available()*4, menusStack.size());
cliSerialPrint("[MIXER] %d available / %d bytes", mixerStack.available()*4, mixerStack.size()); cliSerialPrint("[MIXER] %d available / %d bytes", mixerStack.available()*4, mixerStack.size());
#if defined(AUDIO)
cliSerialPrint("[AUDIO] %d available / %d bytes", audioStack.available()*4, audioStack.size()); cliSerialPrint("[AUDIO] %d available / %d bytes", audioStack.available()*4, audioStack.size());
#endif
#if defined(CLI)
cliSerialPrint("[CLI] %d available / %d bytes", cliStack.available()*4, cliStack.size()); cliSerialPrint("[CLI] %d available / %d bytes", cliStack.available()*4, cliStack.size());
#endif
return 0; return 0;
} }
+2
View File
@@ -273,6 +273,7 @@ void evalFunctions(const CustomFunctionData * functions, CustomFunctionsContext
break; break;
#endif #endif
#if defined(AUDIO)
case FUNC_VOLUME: { case FUNC_VOLUME: {
getvalue_t raw = getValue(CFN_PARAM(cfn)); getvalue_t raw = getValue(CFN_PARAM(cfn));
// only set volume if input changed more than hysteresis // only set volume if input changed more than hysteresis
@@ -284,6 +285,7 @@ void evalFunctions(const CustomFunctionData * functions, CustomFunctionsContext
2048; 2048;
break; break;
} }
#endif
#if defined(SDCARD) #if defined(SDCARD)
case FUNC_PLAY_SOUND: case FUNC_PLAY_SOUND:
+3
View File
@@ -50,7 +50,10 @@ extern uint8_t trimsDisplayTimer;
extern uint8_t trimsDisplayMask; extern uint8_t trimsDisplayMask;
extern uint32_t maxMixerDuration; extern uint32_t maxMixerDuration;
#if defined(AUDIO)
extern uint8_t requiredSpeakerVolume; extern uint8_t requiredSpeakerVolume;
#endif
extern uint8_t requiredBacklightBright; extern uint8_t requiredBacklightBright;
enum MainRequest { enum MainRequest {
+2
View File
@@ -197,8 +197,10 @@ void menuStatisticsDebug(event_t event)
lcdDrawNumber(MENU_DEBUG_COL1_OFS, y, menusStack.available(), LEFT); lcdDrawNumber(MENU_DEBUG_COL1_OFS, y, menusStack.available(), LEFT);
lcdDrawText(lcdLastRightPos, y, "/"); lcdDrawText(lcdLastRightPos, y, "/");
lcdDrawNumber(lcdLastRightPos, y, mixerStack.available(), LEFT); lcdDrawNumber(lcdLastRightPos, y, mixerStack.available(), LEFT);
#if defined(AUDIO)
lcdDrawText(lcdLastRightPos, y, "/"); lcdDrawText(lcdLastRightPos, y, "/");
lcdDrawNumber(lcdLastRightPos, y, audioStack.available(), LEFT); lcdDrawNumber(lcdLastRightPos, y, audioStack.available(), LEFT);
#endif
y += FH; y += FH;
#if defined(DEBUG_LATENCY) #if defined(DEBUG_LATENCY)
+2
View File
@@ -191,8 +191,10 @@ void menuStatisticsDebug(event_t event)
lcdDrawNumber(lcdLastRightPos, y, menusStack.available(), LEFT); lcdDrawNumber(lcdLastRightPos, y, menusStack.available(), LEFT);
lcdDrawText(lcdLastRightPos+2, y+1, "[X]", SMLSIZE); lcdDrawText(lcdLastRightPos+2, y+1, "[X]", SMLSIZE);
lcdDrawNumber(lcdLastRightPos, y, mixerStack.available(), LEFT); lcdDrawNumber(lcdLastRightPos, y, mixerStack.available(), LEFT);
#if defined(AUDIO)
lcdDrawText(lcdLastRightPos+2, y+1, "[A]", SMLSIZE); lcdDrawText(lcdLastRightPos+2, y+1, "[A]", SMLSIZE);
lcdDrawNumber(lcdLastRightPos, y, audioStack.available(), LEFT); lcdDrawNumber(lcdLastRightPos, y, audioStack.available(), LEFT);
#endif
lcdDrawText(lcdLastRightPos+2, y+1, "[I]", SMLSIZE); lcdDrawText(lcdLastRightPos+2, y+1, "[I]", SMLSIZE);
lcdDrawNumber(lcdLastRightPos, y, mainStackAvailable(), LEFT); lcdDrawNumber(lcdLastRightPos, y, mainStackAvailable(), LEFT);
y += FH; y += FH;
@@ -346,9 +346,11 @@ void DebugViewPage::build(Window* window)
new DebugInfoNumber<uint32_t>( new DebugInfoNumber<uint32_t>(
line, rect_t{0, 0, DBG_B_WIDTH, DBG_B_HEIGHT}, line, rect_t{0, 0, DBG_B_WIDTH, DBG_B_HEIGHT},
[] { return mixerStack.available(); }, STR_STACK_MIX); [] { return mixerStack.available(); }, STR_STACK_MIX);
#if defined(AUDIO)
new DebugInfoNumber<uint32_t>( new DebugInfoNumber<uint32_t>(
line, rect_t{0, 0, DBG_B_WIDTH, DBG_B_HEIGHT}, line, rect_t{0, 0, DBG_B_WIDTH, DBG_B_HEIGHT},
[] { return audioStack.available(); }, STR_STACK_AUDIO); [] { return audioStack.available(); }, STR_STACK_AUDIO);
#endif
#if defined(DEBUG_LATENCY) #if defined(DEBUG_LATENCY)
line = window->newLine(grid2); line = window->newLine(grid2);
@@ -55,6 +55,7 @@ class RadioInfoWidget : public TopBarWidget
COLOR_THEME_PRIMARY2); COLOR_THEME_PRIMARY2);
usbIcon->hide(); usbIcon->hide();
#if defined(AUDIO)
audioScale = audioScale =
new StaticIcon(this, W_AUDIO_X + 15, 2, ICON_TOPMENU_VOLUME_SCALE, new StaticIcon(this, W_AUDIO_X + 15, 2, ICON_TOPMENU_VOLUME_SCALE,
COLOR_THEME_PRIMARY3); COLOR_THEME_PRIMARY3);
@@ -66,6 +67,7 @@ class RadioInfoWidget : public TopBarWidget
audioVol[i]->hide(); audioVol[i]->hide();
} }
audioVol[0]->show(); audioVol[0]->show();
#endif
batteryIcon = new StaticIcon(this, W_AUDIO_X, 25, ICON_TOPMENU_TXBATT, batteryIcon = new StaticIcon(this, W_AUDIO_X, 25, ICON_TOPMENU_TXBATT,
COLOR_THEME_PRIMARY2); COLOR_THEME_PRIMARY2);
@@ -130,6 +132,7 @@ class RadioInfoWidget : public TopBarWidget
logsIcon->show(!usbPlugged() && isFunctionActive(FUNCTION_LOGS) && logsIcon->show(!usbPlugged() && isFunctionActive(FUNCTION_LOGS) &&
BLINK_ON_PHASE); BLINK_ON_PHASE);
#if defined(AUDIO)
/* Audio volume */ /* Audio volume */
uint8_t vol = 4; uint8_t vol = 4;
if (requiredSpeakerVolume == 0 || g_eeGeneral.beepMode == e_mode_quiet) if (requiredSpeakerVolume == 0 || g_eeGeneral.beepMode == e_mode_quiet)
@@ -145,6 +148,7 @@ class RadioInfoWidget : public TopBarWidget
audioVol[lastVol]->hide(); audioVol[lastVol]->hide();
lastVol = vol; lastVol = vol;
} }
#endif
#if defined(USB_CHARGER) #if defined(USB_CHARGER)
batteryChargeIcon->show(usbChargerLed()); batteryChargeIcon->show(usbChargerLed());
@@ -193,8 +197,10 @@ class RadioInfoWidget : public TopBarWidget
uint8_t lastRSSI = 0; uint8_t lastRSSI = 0;
StaticIcon* logsIcon; StaticIcon* logsIcon;
StaticIcon* usbIcon; StaticIcon* usbIcon;
#if defined(AUDIO)
StaticIcon* audioScale; StaticIcon* audioScale;
StaticIcon* audioVol[5]; StaticIcon* audioVol[5];
#endif
StaticIcon* batteryIcon; StaticIcon* batteryIcon;
lv_obj_t* batteryFill = nullptr; lv_obj_t* batteryFill = nullptr;
lv_obj_t* rssiBars[5] = {nullptr}; lv_obj_t* rssiBars[5] = {nullptr};
+5
View File
@@ -43,8 +43,11 @@
#include "lua/lua_event.h" #include "lua/lua_event.h"
#endif #endif
#if defined(AUDIO)
uint8_t currentSpeakerVolume = 255; uint8_t currentSpeakerVolume = 255;
uint8_t requiredSpeakerVolume = 255; uint8_t requiredSpeakerVolume = 255;
#endif
uint8_t currentBacklightBright = 0; uint8_t currentBacklightBright = 0;
uint8_t requiredBacklightBright = 0; uint8_t requiredBacklightBright = 0;
uint8_t mainRequestFlags = 0; uint8_t mainRequestFlags = 0;
@@ -265,12 +268,14 @@ void handleJackConnection()
void checkSpeakerVolume() void checkSpeakerVolume()
{ {
#if defined(AUDIO)
if (currentSpeakerVolume != requiredSpeakerVolume) { if (currentSpeakerVolume != requiredSpeakerVolume) {
currentSpeakerVolume = requiredSpeakerVolume; currentSpeakerVolume = requiredSpeakerVolume;
#if !defined(SOFTWARE_VOLUME) #if !defined(SOFTWARE_VOLUME)
setScaledVolume(currentSpeakerVolume); setScaledVolume(currentSpeakerVolume);
#endif #endif
} }
#endif
} }
#if defined(USE_HATS_AS_KEYS) #if defined(USE_HATS_AS_KEYS)
+2
View File
@@ -1126,7 +1126,9 @@ void evalMixes(uint8_t tick10ms)
// must be done after mixing because some functions use the inputs/channels values // must be done after mixing because some functions use the inputs/channels values
// must be done before limits because of the applyLimit function: it checks for safety switches which would be not initialized otherwise // must be done before limits because of the applyLimit function: it checks for safety switches which would be not initialized otherwise
if (tick10ms) { if (tick10ms) {
#if defined(AUDIO)
requiredSpeakerVolume = g_eeGeneral.speakerVolume + VOLUME_LEVEL_DEF; requiredSpeakerVolume = g_eeGeneral.speakerVolume + VOLUME_LEVEL_DEF;
#endif
requiredBacklightBright = g_eeGeneral.getBrightness(); requiredBacklightBright = g_eeGeneral.getBrightness();
+7 -3
View File
@@ -1443,12 +1443,16 @@ void edgeTxInit()
initSerialPorts(); initSerialPorts();
currentSpeakerVolume = requiredSpeakerVolume = g_eeGeneral.speakerVolume + VOLUME_LEVEL_DEF; #if defined(AUDIO)
currentBacklightBright = requiredBacklightBright = g_eeGeneral.getBrightness(); currentSpeakerVolume = requiredSpeakerVolume =
g_eeGeneral.speakerVolume + VOLUME_LEVEL_DEF;
#if !defined(SOFTWARE_VOLUME) #if !defined(SOFTWARE_VOLUME)
setScaledVolume(currentSpeakerVolume); setScaledVolume(currentSpeakerVolume);
#endif #endif
#endif
currentBacklightBright = requiredBacklightBright = g_eeGeneral.getBrightness();
referenceSystemAudioFiles(); referenceSystemAudioFiles();
audioQueue.start(); audioQueue.start();
+3 -1
View File
@@ -35,8 +35,10 @@
RTOS_TASK_HANDLE menusTaskId; RTOS_TASK_HANDLE menusTaskId;
RTOS_DEFINE_STACK(menusTaskId, menusStack, MENUS_STACK_SIZE); RTOS_DEFINE_STACK(menusTaskId, menusStack, MENUS_STACK_SIZE);
#if defined(AUDIO)
RTOS_TASK_HANDLE audioTaskId; RTOS_TASK_HANDLE audioTaskId;
RTOS_DEFINE_STACK(audioTaskId, audioStack, AUDIO_STACK_SIZE); RTOS_DEFINE_STACK(audioTaskId, audioStack, AUDIO_STACK_SIZE);
#endif
RTOS_MUTEX_HANDLE audioMutex; RTOS_MUTEX_HANDLE audioMutex;
@@ -112,7 +114,7 @@ void tasksStart()
RTOS_CREATE_TASK(menusTaskId, menusTask, "menus", menusStack, RTOS_CREATE_TASK(menusTaskId, menusTask, "menus", menusStack,
MENUS_STACK_SIZE, MENUS_TASK_PRIO); MENUS_STACK_SIZE, MENUS_TASK_PRIO);
#if !defined(SIMU) #if !defined(SIMU) && defined(AUDIO)
RTOS_CREATE_TASK(audioTaskId, audioTask, "audio", audioStack, RTOS_CREATE_TASK(audioTaskId, audioTask, "audio", audioStack,
AUDIO_STACK_SIZE, AUDIO_TASK_PRIO); AUDIO_STACK_SIZE, AUDIO_TASK_PRIO);
#endif #endif
+3
View File
@@ -56,7 +56,10 @@
extern TaskStack<MENUS_STACK_SIZE> menusStack; extern TaskStack<MENUS_STACK_SIZE> menusStack;
extern TaskStack<MIXER_STACK_SIZE> mixerStack; extern TaskStack<MIXER_STACK_SIZE> mixerStack;
#if defined(AUDIO)
extern TaskStack<AUDIO_STACK_SIZE> audioStack; extern TaskStack<AUDIO_STACK_SIZE> audioStack;
#endif
#if defined(CLI) #if defined(CLI)
extern TaskStack<CLI_STACK_SIZE> cliStack; extern TaskStack<CLI_STACK_SIZE> cliStack;