Skip to content

Commit

Permalink
Use single function for video switching, auto switch back to radio if…
Browse files Browse the repository at this point in the history
… condition not met.
  • Loading branch information
richardclli committed May 25, 2024
1 parent 99bd205 commit e3f2f5d
Show file tree
Hide file tree
Showing 29 changed files with 7 additions and 33 deletions.
1 change: 0 additions & 1 deletion radio/src/dataconstants.h
Original file line number Diff line number Diff line change
Expand Up @@ -588,7 +588,6 @@ enum Functions {
FUNC_DISABLE_AUDIO_AMP,
FUNC_RGB_LED,
FUNC_LCD_TO_VIDEO,
FUNC_LCD_TO_RADIO,
FUNC_TEST, // MUST remain last
#if defined(DEBUG)
FUNC_MAX SKIP
Expand Down
12 changes: 7 additions & 5 deletions radio/src/functions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ void evalFunctions(const CustomFunctionData * functions, CustomFunctionsContext
}
#endif

bool videoEnabled = false;
for (uint8_t i=0; i<MAX_SPECIAL_FUNCTIONS; i++) {
const CustomFunctionData * cfn = &functions[i];
swsrc_t swtch = CFN_SWITCH(cfn);
Expand Down Expand Up @@ -442,9 +443,7 @@ void evalFunctions(const CustomFunctionData * functions, CustomFunctionsContext
#if defined(VIDEO_SWITCH)
case FUNC_LCD_TO_VIDEO:
switchToVideo();
break;
case FUNC_LCD_TO_RADIO:
switchToRadio();
videoEnabled = true;
break;
#endif
#if defined(DEBUG)
Expand Down Expand Up @@ -476,6 +475,11 @@ void evalFunctions(const CustomFunctionData * functions, CustomFunctionsContext
}
}

#if defined(VIDEO_SWITCH)
if (!videoEnabled)
switchToRadio();
#endif

functionsContext.activeSwitches = newActiveSwitches;
functionsContext.activeFunctions = newActiveFunctions;
}
Expand Down Expand Up @@ -557,8 +561,6 @@ const char* funcGetLabel(uint8_t func)
return STR_SF_RGBLEDS;
case FUNC_LCD_TO_VIDEO:
return STR_SF_LCD_TO_VIDEO;
case FUNC_LCD_TO_RADIO:
return STR_SF_LCD_TO_RADIO;
#if defined(DEBUG)
case FUNC_TEST:
return STR_SF_TEST;
Expand Down
1 change: 0 additions & 1 deletion radio/src/storage/yaml/yaml_datastructs_128x64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ const struct YamlIdStr enum_Functions[] = {
{ FUNC_DISABLE_AUDIO_AMP, "DISABLE_AUDIO_AMP" },
{ FUNC_RGB_LED, "RGB_LED" },
{ FUNC_LCD_TO_VIDEO, "LCD_TO_VIDEO" },
{ FUNC_LCD_TO_RADIO, "LCD_TO_RADIO" },
{ FUNC_TEST, "TEST" },
{ 0, NULL }
};
Expand Down
1 change: 0 additions & 1 deletion radio/src/storage/yaml/yaml_datastructs_nv14.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ const struct YamlIdStr enum_Functions[] = {
{ FUNC_DISABLE_AUDIO_AMP, "DISABLE_AUDIO_AMP" },
{ FUNC_RGB_LED, "RGB_LED" },
{ FUNC_LCD_TO_VIDEO, "LCD_TO_VIDEO" },
{ FUNC_LCD_TO_RADIO, "LCD_TO_RADIO" },
{ FUNC_TEST, "TEST" },
{ 0, NULL }
};
Expand Down
1 change: 0 additions & 1 deletion radio/src/storage/yaml/yaml_datastructs_pl18.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ const struct YamlIdStr enum_Functions[] = {
{ FUNC_DISABLE_AUDIO_AMP, "DISABLE_AUDIO_AMP" },
{ FUNC_RGB_LED, "RGB_LED" },
{ FUNC_LCD_TO_VIDEO, "LCD_TO_VIDEO" },
{ FUNC_LCD_TO_RADIO, "LCD_TO_RADIO" },
{ FUNC_TEST, "TEST" },
{ 0, NULL }
};
Expand Down
1 change: 0 additions & 1 deletion radio/src/storage/yaml/yaml_datastructs_t20.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ const struct YamlIdStr enum_Functions[] = {
{ FUNC_DISABLE_AUDIO_AMP, "DISABLE_AUDIO_AMP" },
{ FUNC_RGB_LED, "RGB_LED" },
{ FUNC_LCD_TO_VIDEO, "LCD_TO_VIDEO" },
{ FUNC_LCD_TO_RADIO, "LCD_TO_RADIO" },
{ FUNC_TEST, "TEST" },
{ 0, NULL }
};
Expand Down
1 change: 0 additions & 1 deletion radio/src/storage/yaml/yaml_datastructs_tpro.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ const struct YamlIdStr enum_Functions[] = {
{ FUNC_DISABLE_AUDIO_AMP, "DISABLE_AUDIO_AMP" },
{ FUNC_RGB_LED, "RGB_LED" },
{ FUNC_LCD_TO_VIDEO, "LCD_TO_VIDEO" },
{ FUNC_LCD_TO_RADIO, "LCD_TO_RADIO" },
{ FUNC_TEST, "TEST" },
{ 0, NULL }
};
Expand Down
1 change: 0 additions & 1 deletion radio/src/storage/yaml/yaml_datastructs_x10.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ const struct YamlIdStr enum_Functions[] = {
{ FUNC_DISABLE_AUDIO_AMP, "DISABLE_AUDIO_AMP" },
{ FUNC_RGB_LED, "RGB_LED" },
{ FUNC_LCD_TO_VIDEO, "LCD_TO_VIDEO" },
{ FUNC_LCD_TO_RADIO, "LCD_TO_RADIO" },
{ FUNC_TEST, "TEST" },
{ 0, NULL }
};
Expand Down
1 change: 0 additions & 1 deletion radio/src/storage/yaml/yaml_datastructs_x12s.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ const struct YamlIdStr enum_Functions[] = {
{ FUNC_DISABLE_AUDIO_AMP, "DISABLE_AUDIO_AMP" },
{ FUNC_RGB_LED, "RGB_LED" },
{ FUNC_LCD_TO_VIDEO, "LCD_TO_VIDEO" },
{ FUNC_LCD_TO_RADIO, "LCD_TO_RADIO" },
{ FUNC_TEST, "TEST" },
{ 0, NULL }
};
Expand Down
1 change: 0 additions & 1 deletion radio/src/storage/yaml/yaml_datastructs_x9d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ const struct YamlIdStr enum_Functions[] = {
{ FUNC_DISABLE_AUDIO_AMP, "DISABLE_AUDIO_AMP" },
{ FUNC_RGB_LED, "RGB_LED" },
{ FUNC_LCD_TO_VIDEO, "LCD_TO_VIDEO" },
{ FUNC_LCD_TO_RADIO, "LCD_TO_RADIO" },
{ FUNC_TEST, "TEST" },
{ 0, NULL }
};
Expand Down
1 change: 0 additions & 1 deletion radio/src/storage/yaml/yaml_datastructs_x9e.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ const struct YamlIdStr enum_Functions[] = {
{ FUNC_DISABLE_AUDIO_AMP, "DISABLE_AUDIO_AMP" },
{ FUNC_RGB_LED, "RGB_LED" },
{ FUNC_LCD_TO_VIDEO, "LCD_TO_VIDEO" },
{ FUNC_LCD_TO_RADIO, "LCD_TO_RADIO" },
{ FUNC_TEST, "TEST" },
{ 0, NULL }
};
Expand Down
1 change: 0 additions & 1 deletion radio/src/storage/yaml/yaml_datastructs_xlites.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ const struct YamlIdStr enum_Functions[] = {
{ FUNC_DISABLE_AUDIO_AMP, "DISABLE_AUDIO_AMP" },
{ FUNC_RGB_LED, "RGB_LED" },
{ FUNC_LCD_TO_VIDEO, "LCD_TO_VIDEO" },
{ FUNC_LCD_TO_RADIO, "LCD_TO_RADIO" },
{ FUNC_TEST, "TEST" },
{ 0, NULL }
};
Expand Down
1 change: 0 additions & 1 deletion radio/src/translations.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,6 @@ const char STR_SF_SAFETY[] = TR_SF_SAFETY;
const char STR_SF_SET_SCREEN[] = TR_SF_SET_SCREEN;
const char STR_SF_SCREENSHOT[] = TR_SF_SCREENSHOT;
const char STR_SF_LCD_TO_VIDEO[] = TR_SF_LCD_TO_VIDEO;
const char STR_SF_LCD_TO_RADIO[] = TR_SF_LCD_TO_RADIO;
const char STR_SF_TEST[] = TR_SF_TEST;
const char STR_TRIMS[] = TR_TRIMS;
const char STR_MIRROR[] = TR_MIRROR;
Expand Down
1 change: 0 additions & 1 deletion radio/src/translations/cn.h
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,6 @@
#define TR_SF_DISABLE_AUDIO_AMP "关闭音频功放"
#define TR_SF_SET_SCREEN "选择主屏"
#define TR_SF_LCD_TO_VIDEO "屏幕显示图传"
#define TR_SF_LCD_TO_RADIO "屏幕显示界面"

#define TR_FSW_RESET_TELEM "回传参数"

Expand Down
1 change: 0 additions & 1 deletion radio/src/translations/cz.h
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,6 @@
#define TR_SF_DISABLE_AUDIO_AMP "Vypnutí zesilovače zvuku"
#define TR_SF_SET_SCREEN "Vybrat hlavní obrazovku"
#define TR_SF_LCD_TO_VIDEO "LCD to Video"
#define TR_SF_LCD_TO_RADIO "LCD to Radio"

#define TR_FSW_RESET_TELEM TR("Telm","Telemetrie")

Expand Down
1 change: 0 additions & 1 deletion radio/src/translations/de.h
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,6 @@
#define TR_SF_DISABLE_AUDIO_AMP "Audio Verst. Aus"
#define TR_SF_SET_SCREEN "Set Main Screen"
#define TR_SF_LCD_TO_VIDEO "LCD to Video"
#define TR_SF_LCD_TO_RADIO "LCD to Radio"

#define TR_FSW_RESET_TELEM TR("Telm","Telemetrie")
#define TR_FSW_RESET_TIMERS "Tmr1","Tmr2","Tmr3"
Expand Down
1 change: 0 additions & 1 deletion radio/src/translations/en.h
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,6 @@
#define TR_SF_DISABLE_AUDIO_AMP "Audio Amp Off"
#define TR_SF_SET_SCREEN "Set Main Screen"
#define TR_SF_LCD_TO_VIDEO "LCD to Video"
#define TR_SF_LCD_TO_RADIO "LCD to Radio"

#define TR_FSW_RESET_TELEM TR("Telm", "Telemetry")
#define TR_FSW_RESET_TIMERS "Tmr1","Tmr2","Tmr3"
Expand Down
1 change: 0 additions & 1 deletion radio/src/translations/es.h
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,6 @@
#define TR_SF_DISABLE_AUDIO_AMP "Audio Amp Off"
#define TR_SF_SET_SCREEN "Set Main Screen"
#define TR_SF_LCD_TO_VIDEO "LCD to Video"
#define TR_SF_LCD_TO_RADIO "LCD to Radio"

#define TR_FSW_RESET_TELEM TR("Telm", "Telemetría")
#define TR_FSW_RESET_TIMERS "Tmr1","Tmr2","Tmr3"
Expand Down
1 change: 0 additions & 1 deletion radio/src/translations/fi.h
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,6 @@
#define TR_SF_DISABLE_AUDIO_AMP "Audio Amp Off"
#define TR_SF_SET_SCREEN "Set Main Screen"
#define TR_SF_LCD_TO_VIDEO "LCD to Video"
#define TR_SF_LCD_TO_RADIO "LCD to Radio"

#define TR_FSW_RESET_TELEM TR("Telm","Telemetry")
#define TR_FSW_RESET_TIMERS "Tmr1","Tmr2","Tmr3"
Expand Down
1 change: 0 additions & 1 deletion radio/src/translations/fr.h
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,6 @@
#define TR_SF_DISABLE_AUDIO_AMP "Désact. Ampli Audio"
#define TR_SF_SET_SCREEN "Définir Écran Princ."
#define TR_SF_LCD_TO_VIDEO "LCD to Video"
#define TR_SF_LCD_TO_RADIO "LCD to Radio"

#define TR_FSW_RESET_TELEM TR("Télem.", "Télémétrie")
#define TR_FSW_RESET_TIMERS "Chr1","Chr2","Chr3"
Expand Down
1 change: 0 additions & 1 deletion radio/src/translations/he.h
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,6 @@
#define TR_SF_DISABLE_AUDIO_AMP "Audio Amp Off"
#define TR_SF_SET_SCREEN "הגדרת מסך ראשי"
#define TR_SF_LCD_TO_VIDEO "LCD to Video"
#define TR_SF_LCD_TO_RADIO "LCD to Radio"

#define TR_FSW_RESET_TELEM TR("Telm", "טלמטריה")
#define TR_FSW_RESET_TIMERS "שעון 1","שעון 2","שעון 3"
Expand Down
1 change: 0 additions & 1 deletion radio/src/translations/it.h
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,6 @@
#define TR_SF_DISABLE_AUDIO_AMP "Amp Audio Off"
#define TR_SF_SET_SCREEN "Setta Schermo Princ."
#define TR_SF_LCD_TO_VIDEO "LCD to Video"
#define TR_SF_LCD_TO_RADIO "LCD to Radio"

#define TR_FSW_RESET_TELEM TR("Telm", "Telemetria")
#define TR_FSW_RESET_TIMERS "Tmr1","Tmr2","Tmr3"
Expand Down
1 change: 0 additions & 1 deletion radio/src/translations/jp.h
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,6 @@
#define TR_SF_DISABLE_AUDIO_AMP "オーディオアンプ OFF"
#define TR_SF_SET_SCREEN "メイン画面設定"
#define TR_SF_LCD_TO_VIDEO "LCD to Video"
#define TR_SF_LCD_TO_RADIO "LCD to Radio"

#define TR_FSW_RESET_TELEM TR("Telm", "テレメトリー")
#define TR_FSW_RESET_TIMERS "Tmr1","Tmr2","Tmr3"
Expand Down
1 change: 0 additions & 1 deletion radio/src/translations/nl.h
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,6 @@
#define TR_SF_DISABLE_AUDIO_AMP "Audio Amp Off"
#define TR_SF_SET_SCREEN "Set Main Screen"
#define TR_SF_LCD_TO_VIDEO "LCD to Video"
#define TR_SF_LCD_TO_RADIO "LCD to Radio"

#define TR_FSW_RESET_TELEM TR("Telm", "Telemetrie")
#define TR_FSW_RESET_TIMERS "Tmr1","Tmr2","Tmr3"
Expand Down
1 change: 0 additions & 1 deletion radio/src/translations/pl.h
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,6 @@
#define TR_SF_DISABLE_AUDIO_AMP TR("Wycisz wzm.", "Wycisz wzmacniacz audio")
#define TR_SF_SET_SCREEN "Set Main Screen"
#define TR_SF_LCD_TO_VIDEO "LCD to Video"
#define TR_SF_LCD_TO_RADIO "LCD to Radio"

#define TR_FSW_RESET_TELEM TR("Telm", "Telemetra")
#define TR_FSW_RESET_TIMERS "Tmr1","Tmr2","Tmr3"
Expand Down
1 change: 0 additions & 1 deletion radio/src/translations/pt.h
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,6 @@
#define TR_SF_DISABLE_AUDIO_AMP "Amp Audio Desl"
#define TR_SF_SET_SCREEN "Def Tela Princ"
#define TR_SF_LCD_TO_VIDEO "LCD to Video"
#define TR_SF_LCD_TO_RADIO "LCD to Radio"

#define TR_FSW_RESET_TELEM TR("Telm", "Telemetria")
#define TR_FSW_RESET_TIMERS "Tmr1","Tmr2","Tmr3"
Expand Down
1 change: 0 additions & 1 deletion radio/src/translations/ru.h
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,6 @@
#define TR_SF_DISABLE_AUDIO_AMP "Вык аудио усил."
#define TR_SF_SET_SCREEN "Выбр глав экран"
#define TR_SF_LCD_TO_VIDEO "LCD to Video"
#define TR_SF_LCD_TO_RADIO "LCD to Radio"

#define TR_FSW_RESET_TELEM TR("Телем", "Телеметрия")
#define TR_FSW_RESET_TIMERS "Тмр1","Трм2","Трм3"
Expand Down
1 change: 0 additions & 1 deletion radio/src/translations/se.h
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,6 @@
#define TR_SF_DISABLE_AUDIO_AMP TR("Audioförst. av","Audioförstärkare av")
#define TR_SF_SET_SCREEN "Sätt huvudskärm"
#define TR_SF_LCD_TO_VIDEO "LCD to Video"
#define TR_SF_LCD_TO_RADIO "LCD to Radio"

#define TR_FSW_RESET_TELEM TR("Telm","Telemetri")
#define TR_FSW_RESET_TIMERS "Tmr1","Tmr2","Tmr3"
Expand Down
1 change: 0 additions & 1 deletion radio/src/translations/tw.h
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,6 @@
#define TR_SF_DISABLE_AUDIO_AMP "關閉音頻功放"
#define TR_SF_SET_SCREEN "選擇主屏"
#define TR_SF_LCD_TO_VIDEO "屏幕顯示圖傳"
#define TR_SF_LCD_TO_RADIO "屏幕顯示界面"

#define TR_FSW_RESET_TELEM "回傳參數"

Expand Down

0 comments on commit e3f2f5d

Please sign in to comment.