From ef24e2edd0b5dfc9ef180b7eade779b0310a62d8 Mon Sep 17 00:00:00 2001 From: pitts-mo Date: Sat, 8 Jul 2023 08:58:59 -0400 Subject: [PATCH 1/7] Update main.c AnalogRX Power "Auto" -batch 2 google --- src/core/main.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/core/main.c b/src/core/main.c index b827a911..2fe09f96 100644 --- a/src/core/main.c +++ b/src/core/main.c @@ -124,7 +124,6 @@ static void device_init(void) { TP2825_Config(0, 0); DM5680_req_ver(); fans_top_setspeed(g_setting.fans.top_speed); - DM5680_Power_AnalogModule(g_setting.power.power_ana); } void lvgl_init() { @@ -188,7 +187,10 @@ int main(int argc, char *argv[]) { // 8. Synthetic counter for gif refresh gif_cnt = 0; - + + // 8.1 set initial analog module power state + Analog_Module_Power(0); + // 10. Execute main loop g_init_done = 1; for (;;) { From 271407c9df14b0ad3d1fef2f5580802440434eee Mon Sep 17 00:00:00 2001 From: pitts-mo Date: Sat, 8 Jul 2023 09:07:06 -0400 Subject: [PATCH 2/7] Update hardware.h AnalogRX Power "Auto" -batch 2 google --- src/driver/hardware.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/driver/hardware.h b/src/driver/hardware.h index d2e217d5..f17eac4b 100644 --- a/src/driver/hardware.h +++ b/src/driver/hardware.h @@ -65,6 +65,8 @@ void Set_Saturation(uint8_t sat); void Set_HT_status(uint8_t is_open, uint8_t frame_period, uint8_t sync_len); void Set_HT_dat(uint16_t ch0, uint16_t ch1, uint16_t ch2); +void Analog_Module_Power(bool Force); + int HDZERO_detect(); int AV_in_detect(); void HDMI_in_detect(); From 60c576aedf82b45c9b75311feba6bf8e21584597 Mon Sep 17 00:00:00 2001 From: pitts-mo Date: Sat, 8 Jul 2023 09:08:51 -0400 Subject: [PATCH 3/7] Update hardware.c AnalogRX Power "Auto" -batch 2 google --- src/driver/hardware.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/driver/hardware.c b/src/driver/hardware.c index e249ca8f..df0e1be2 100644 --- a/src/driver/hardware.c +++ b/src/driver/hardware.c @@ -8,11 +8,13 @@ #include +#include "../core/app_state.h" #include "../core/common.hh" #include "../core/osd.h" #include "../core/settings.h" #include "../ui/page_common.h" #include "TP2825.h" +#include "beep.h" #include "defines.h" #include "dm5680.h" #include "dm6302.h" @@ -593,6 +595,28 @@ void Set_HT_dat(uint16_t ch0, uint16_t ch1, uint16_t ch2) { I2C_Write(ADDR_FPGA, 0x77, (ch2 >> 8) & 0xff); } +void Analog_Module_Power(bool ForceSet) { + // Batch 2 goggles only + if (getHwRevision() >= HW_REV_2) { + static bool Analog_Module_Power_State = 0; + static bool Analog_Module_Power_State_Last = 0; + if (g_setting.power.power_ana == 0) { + Analog_Module_Power_State = 0; + } else { + if (g_source_info.source != SOURCE_EXPANSION) { + Analog_Module_Power_State = 1; + } else { + Analog_Module_Power_State = 0; + } + } + if ((Analog_Module_Power_State_Last != Analog_Module_Power_State) || (ForceSet == 1)) { + beep(); + Analog_Module_Power_State_Last = Analog_Module_Power_State; + DM5680_Power_AnalogModule(Analog_Module_Power_State); + } + } +} + int Get_VideoLatancy_status() // ret: 0=unlocked, 1=locked { uint8_t rdat = 0; From a11cfa5b9c61903f4d5af554c602e4f02c0a07c8 Mon Sep 17 00:00:00 2001 From: pitts-mo Date: Sat, 8 Jul 2023 09:11:09 -0400 Subject: [PATCH 4/7] Update page_sleep.c AnalogRX Power "Auto" -batch 2 google --- src/ui/page_sleep.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/ui/page_sleep.c b/src/ui/page_sleep.c index 7804c384..5fe3cfa5 100644 --- a/src/ui/page_sleep.c +++ b/src/ui/page_sleep.c @@ -69,10 +69,8 @@ static void page_sleep_enter() { static void page_sleep_exit() { LOGI("page_sleep_exit"); OLED_ON(1); // Turn on OLED - if (getHwRevision() >= HW_REV_2) { - DM5680_Power_AnalogModule(g_setting.power.power_ana); - } - + Analog_Module_Power(1); + g_setting.fans.top_speed = fan_speed_save.top; g_setting.fans.left_speed = fan_speed_save.left; g_setting.fans.right_speed = fan_speed_save.right; From 879638b08e829e069b1e0f9be967c28ba48c95dd Mon Sep 17 00:00:00 2001 From: pitts-mo Date: Sat, 8 Jul 2023 09:11:53 -0400 Subject: [PATCH 5/7] Update page_source.c AnalogRX Power "Auto" -batch 2 google --- src/ui/page_source.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/ui/page_source.c b/src/ui/page_source.c index 72a6b742..5c71bcea 100644 --- a/src/ui/page_source.c +++ b/src/ui/page_source.c @@ -160,6 +160,7 @@ static void page_source_on_click(uint8_t key, int sel) { break; } } + Analog_Module_Power(0); } static void page_source_enter() { From e4231ea59abfc9b7625667a1fcc8e005d973a897 Mon Sep 17 00:00:00 2001 From: pitts-mo Date: Sat, 8 Jul 2023 09:13:14 -0400 Subject: [PATCH 6/7] Update page_power.c AnalogRX Power "Auto" -batch 2 google --- src/ui/page_power.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/ui/page_power.c b/src/ui/page_power.c index 28af22a7..dbc2a3e6 100644 --- a/src/ui/page_power.c +++ b/src/ui/page_power.c @@ -10,6 +10,7 @@ #include "core/common.hh" #include "core/settings.h" #include "driver/dm5680.h" +#include "driver/hardware.h" #include "driver/mcp3021.h" #include "page_common.h" #include "ui/ui_style.h" @@ -98,7 +99,7 @@ static lv_obj_t *page_power_create(lv_obj_t *parent, panel_arr_t *arr) { // Batch 2 goggles only if (getHwRevision() >= HW_REV_2) { - create_btn_group_item(&btn_group_power_ana, cont, 2, "AnalogRX Power", "On", "Off", "", "", ROW_POWER_ANA); + create_btn_group_item(&btn_group_power_ana, cont, 2, "AnalogRX Power", "On", "Auto", "", "", ROW_POWER_ANA); } // Back entry @@ -248,7 +249,7 @@ static void page_power_on_click(uint8_t key, int sel) { btn_group_toggle_sel(&btn_group_power_ana); g_setting.power.power_ana = btn_group_get_sel(&btn_group_power_ana); ini_putl("power", "power_ana_rx", g_setting.power.power_ana, SETTING_INI); - DM5680_Power_AnalogModule(g_setting.power.power_ana); + Analog_Module_Power(1); } break; @@ -269,4 +270,4 @@ page_pack_t pp_power = { .on_roller = NULL, .on_click = page_power_on_click, .on_right_button = NULL, -}; \ No newline at end of file +}; From 21035fac2c17997e96f2dfe7b6db73869c9f10df Mon Sep 17 00:00:00 2001 From: pitts-mo Date: Mon, 31 Jul 2023 07:06:58 -0400 Subject: [PATCH 7/7] Update hardware.c format cleanup --- src/driver/hardware.c | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/src/driver/hardware.c b/src/driver/hardware.c index df0e1be2..6c261598 100644 --- a/src/driver/hardware.c +++ b/src/driver/hardware.c @@ -596,25 +596,25 @@ void Set_HT_dat(uint16_t ch0, uint16_t ch1, uint16_t ch2) { } void Analog_Module_Power(bool ForceSet) { - // Batch 2 goggles only - if (getHwRevision() >= HW_REV_2) { - static bool Analog_Module_Power_State = 0; - static bool Analog_Module_Power_State_Last = 0; - if (g_setting.power.power_ana == 0) { - Analog_Module_Power_State = 0; - } else { - if (g_source_info.source != SOURCE_EXPANSION) { - Analog_Module_Power_State = 1; - } else { - Analog_Module_Power_State = 0; - } - } - if ((Analog_Module_Power_State_Last != Analog_Module_Power_State) || (ForceSet == 1)) { - beep(); - Analog_Module_Power_State_Last = Analog_Module_Power_State; - DM5680_Power_AnalogModule(Analog_Module_Power_State); - } - } + // Batch 2 goggles only + if (getHwRevision() >= HW_REV_2) { + static bool Analog_Module_Power_State = 0; + static bool Analog_Module_Power_State_Last = 0; + if (g_setting.power.power_ana == 0) { + Analog_Module_Power_State = 0; + } else { + if (g_source_info.source != SOURCE_EXPANSION) { + Analog_Module_Power_State = 1; + } else { + Analog_Module_Power_State = 0; + } + } + if ((Analog_Module_Power_State_Last != Analog_Module_Power_State) || (ForceSet == 1)) { + beep(); + Analog_Module_Power_State_Last = Analog_Module_Power_State; + DM5680_Power_AnalogModule(Analog_Module_Power_State); + } + } } int Get_VideoLatancy_status() // ret: 0=unlocked, 1=locked