diff --git a/examples/UnitTest/UnitTest.ino b/examples/UnitTest/UnitTest.ino index c8b8c25..d961f63 100644 --- a/examples/UnitTest/UnitTest.ino +++ b/examples/UnitTest/UnitTest.ino @@ -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!"); } diff --git a/examples/UnitTest/ui.cpp b/examples/UnitTest/ui.cpp index 8122265..094c4a1 100644 --- a/examples/UnitTest/ui.cpp +++ b/examples/UnitTest/ui.cpp @@ -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); + + 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); + 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 diff --git a/platformio.ini b/platformio.ini index d9d2741..24951e7 100644 --- a/platformio.ini +++ b/platformio.ini @@ -16,21 +16,20 @@ password = ${sysenv.PIO_WIFI_PASSWORD} ; default_envs = T-Keyboard ; src_dir = examples/Keyboard_ESP32C3 - ; Please comment out the following when compiling the T-Keyboard default_envs = T-Deck ;; Examples only one is valid -; src_dir = examples/UnitTest +src_dir = examples/UnitTest ; src_dir = examples/Microphone ; src_dir = examples/Touchpad ; src_dir = examples/lvgl_example ; src_dir = examples/Keyboard_T_Deck_Master ; src_dir = examples/GPSShield ; src_dir = examples/LoRaWAN_Starter -src_dir = examples/I2SPlay +; src_dir = examples/I2SPlay ; src_dir = examples/LvglArduinoVNC_VGA @@ -51,13 +50,35 @@ upload_speed = 921600 monitor_speed = 115200 build_flags = -DBOARD_HAS_PSRAM=1 - -DCORE_DEBUG_LEVEL=5 + -DCORE_DEBUG_LEVEL=1 + ; Enable UARDUINO_ USB_ CDC_ ON_ BOOT will start printing and wait for terminal access during startup -DARDUINO_USB_CDC_ON_BOOT=1 - '-DWIFI_SSID="${wifi.ssid}"' - '-DWIFI_PASS="${wifi.password}"' ; Enable UARDUINO_USB_CDC_ON_BOOT will turn off printing and will not block when using the battery ; -UARDUINO_USB_CDC_ON_BOOT - ; -DDISABLE_ALL_LIBRARY_WARNINGS + + '-DWIFI_SSID="${wifi.ssid}"' + '-DWIFI_PASSWORD="${wifi.password}"' + + -DDISABLE_ALL_LIBRARY_WARNINGS + + -DRADIOLIB_EXCLUDE_CC1101 + -DRADIOLIB_EXCLUDE_NRF24 + -DRADIOLIB_EXCLUDE_RF69 + -DRADIOLIB_EXCLUDE_SX1231 + -DRADIOLIB_EXCLUDE_SI443X + -DRADIOLIB_EXCLUDE_RFM2X + -DRADIOLIB_EXCLUDE_SX127X + ; -DRADIOLIB_EXCLUDE_STM32WLX + ; -DRADIOLIB_EXCLUDE_SX128X + -DRADIOLIB_EXCLUDE_AFSK + -DRADIOLIB_EXCLUDE_AX25 + -DRADIOLIB_EXCLUDE_HELLSCHREIBER + -DRADIOLIB_EXCLUDE_MORSE + -DRADIOLIB_EXCLUDE_RTTY + -DRADIOLIB_EXCLUDE_SSTV + -DRADIOLIB_EXCLUDE_DIRECT_RECEIVE + -DRADIOLIB_EXCLUDE_APRS + -DRADIOLIB_EXCLUDE_BELL