Fixed the stuck boot screen caused by lack of LoRa
This commit is contained in:
@@ -98,7 +98,6 @@ TouchDrvGT911 touch;
|
||||
lv_indev_t *kb_indev = NULL;
|
||||
lv_indev_t *mouse_indev = NULL;
|
||||
lv_indev_t *touch_indev = NULL;
|
||||
lv_group_t *kb_indev_group;
|
||||
|
||||
|
||||
LV_IMG_DECLARE(image_emoji);
|
||||
@@ -265,7 +264,7 @@ static void wifi_event_cb(WiFiEvent_t event)
|
||||
void setupWiFi()
|
||||
{
|
||||
WiFi.onEvent(wifi_event_cb);
|
||||
WiFi.begin(WIFI_SSID, WIFI_PASS);
|
||||
WiFi.begin(WIFI_SSID, WIFI_PASSWORD);
|
||||
|
||||
configTzTime(DEFAULT_TIMEZONE, NTP_SERVER1, NTP_SERVER2);
|
||||
// set notification call-back function
|
||||
@@ -324,6 +323,8 @@ bool setupRadio()
|
||||
} else {
|
||||
Serial.print("Start Radio failed,code:");
|
||||
Serial.println(state);
|
||||
// T-Deck without LoRa, reinitialize SPI
|
||||
SPI.begin(BOARD_SPI_SCK, BOARD_SPI_MISO, BOARD_SPI_MOSI);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -670,7 +671,7 @@ void vadTask(void *params)
|
||||
#error "ESP VAD Not support Version > V5.0.0 , please use IDF V4.4.4"
|
||||
#endif
|
||||
if (vad_state == VAD_SPEECH) {
|
||||
Serial.print(millis());
|
||||
// Serial.print(millis());
|
||||
// Serial.println(" -> Noise detected!!!");
|
||||
updateNoiseLabel(vad_detected_counter++);
|
||||
last_update_millis = millis();
|
||||
@@ -782,16 +783,25 @@ void setupAmpI2S(i2s_port_t i2s_ch)
|
||||
|
||||
void setTx()
|
||||
{
|
||||
if (!hasRadio) {
|
||||
return ;
|
||||
}
|
||||
sender = radio.startTransmit("Hello World!") == RADIOLIB_ERR_NONE;
|
||||
}
|
||||
|
||||
void setRx()
|
||||
{
|
||||
if (!hasRadio) {
|
||||
return ;
|
||||
}
|
||||
sender = ! (radio.startReceive() == RADIOLIB_ERR_NONE);
|
||||
}
|
||||
|
||||
void setFreq(float f)
|
||||
{
|
||||
if (!hasRadio) {
|
||||
return ;
|
||||
}
|
||||
if (radio.setFrequency(f) != RADIOLIB_ERR_NONE) {
|
||||
Serial.println("setFrequency failed!");
|
||||
}
|
||||
@@ -799,6 +809,9 @@ void setFreq(float f)
|
||||
|
||||
void setBandWidth(float bw)
|
||||
{
|
||||
if (!hasRadio) {
|
||||
return ;
|
||||
}
|
||||
if (radio.setBandwidth(bw) != RADIOLIB_ERR_NONE) {
|
||||
Serial.println("setBandwidth failed!");
|
||||
}
|
||||
@@ -806,6 +819,9 @@ void setBandWidth(float bw)
|
||||
|
||||
void setTxPower(int16_t dBm)
|
||||
{
|
||||
if (!hasRadio) {
|
||||
return ;
|
||||
}
|
||||
if (radio.setOutputPower(dBm) != RADIOLIB_ERR_NONE) {
|
||||
Serial.println("setOutputPower failed!");
|
||||
}
|
||||
|
||||
+30
-18
@@ -228,6 +228,7 @@ static void radio_interval_cb(lv_event_t *e)
|
||||
|
||||
|
||||
LV_IMG_DECLARE(wallpaper);
|
||||
extern bool hasRadio;
|
||||
|
||||
void setupUI(void)
|
||||
{
|
||||
@@ -256,30 +257,41 @@ void setupUI(void)
|
||||
section = lv_menu_section_create(sub_mechanics_page);
|
||||
sub_section.push_back(section);
|
||||
|
||||
lv_obj_t *swTx = create_switch(section, LV_SYMBOL_UP, "Tx", true, lv_radio_tx_event_cb);
|
||||
lv_obj_t *swRx = create_switch(section, LV_SYMBOL_DOWN, "Rx", false, lv_radio_rx_event_cb);
|
||||
if (hasRadio) {
|
||||
|
||||
lv_obj_set_user_data(swTx, swRx);
|
||||
lv_obj_set_user_data(swRx, swTx);
|
||||
lv_obj_t *swTx = create_switch(section, LV_SYMBOL_UP, "Tx", true, lv_radio_tx_event_cb);
|
||||
lv_obj_t *swRx = create_switch(section, LV_SYMBOL_DOWN, "Rx", false, lv_radio_rx_event_cb);
|
||||
|
||||
create_label(section, LV_SYMBOL_LOOP, "Message", NULL);
|
||||
sub_radio_val.label_radio_msg = create_label(section, NULL, NULL, "N.A");
|
||||
lv_obj_set_user_data(swTx, swRx);
|
||||
lv_obj_set_user_data(swRx, swTx);
|
||||
|
||||
lv_obj_t *sub_rf_setting_page = lv_menu_page_create(menu, NULL);
|
||||
lv_obj_set_style_pad_hor(sub_rf_setting_page, lv_obj_get_style_pad_left(lv_menu_get_main_header(menu), 0), 0);
|
||||
section = lv_menu_section_create(sub_rf_setting_page);
|
||||
sub_section.push_back(section);
|
||||
create_label(section, LV_SYMBOL_LOOP, "Message", NULL);
|
||||
sub_radio_val.label_radio_msg = create_label(section, NULL, NULL, "N.A");
|
||||
|
||||
create_dropdown(section, NULL, "Freq", radio_freq_list, 2, radio_freq_cb);
|
||||
create_dropdown(section, NULL, "BandWidth", radio_bandwidth_list, 0, radio_bandwidth_cb);
|
||||
create_dropdown(section, NULL, "TxPower", radio_power_level_list, 6, radio_power_cb);
|
||||
create_dropdown(section, NULL, "Interval", radio_tx_interval_list, 3, radio_interval_cb);
|
||||
lv_obj_t *sub_rf_setting_page = lv_menu_page_create(menu, NULL);
|
||||
lv_obj_set_style_pad_hor(sub_rf_setting_page, lv_obj_get_style_pad_left(lv_menu_get_main_header(menu), 0), 0);
|
||||
section = lv_menu_section_create(sub_rf_setting_page);
|
||||
sub_section.push_back(section);
|
||||
|
||||
section = lv_menu_section_create(sub_mechanics_page);
|
||||
sub_section.push_back(section);
|
||||
create_dropdown(section, NULL, "Freq", radio_freq_list, 2, radio_freq_cb);
|
||||
create_dropdown(section, NULL, "BandWidth", radio_bandwidth_list, 0, radio_bandwidth_cb);
|
||||
create_dropdown(section, NULL, "TxPower", radio_power_level_list, 6, radio_power_cb);
|
||||
create_dropdown(section, NULL, "Interval", radio_tx_interval_list, 3, radio_interval_cb);
|
||||
|
||||
cont = create_text(section, LV_SYMBOL_SETTINGS, "Radio Configure", LV_MENU_ITEM_BUILDER_VARIANT_1);
|
||||
lv_menu_set_load_page_event(menu, cont, sub_rf_setting_page);
|
||||
section = lv_menu_section_create(sub_mechanics_page);
|
||||
sub_section.push_back(section);
|
||||
|
||||
cont = create_text(section, LV_SYMBOL_SETTINGS, "Radio Configure", LV_MENU_ITEM_BUILDER_VARIANT_1);
|
||||
lv_menu_set_load_page_event(menu, cont, sub_rf_setting_page);
|
||||
|
||||
} else {
|
||||
lv_obj_t *cont = lv_obj_create(sub_mechanics_page);
|
||||
lv_obj_set_size(cont, LV_PCT(100), LV_PCT(95));
|
||||
sub_section.push_back(cont);
|
||||
lv_obj_t *label = lv_label_create(cont);
|
||||
lv_label_set_text(label, "Radio is offline");
|
||||
lv_obj_center(label);
|
||||
}
|
||||
|
||||
|
||||
// !SOUND
|
||||
|
||||
Reference in New Issue
Block a user