diff --git a/CHANGELOG.md b/CHANGELOG.md old mode 100755 new mode 100644 index 5685f6f..770dc38 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,8 @@ # Changelog +## (8.30.22) +- Added SDCard test + + ## (8.19.2022) - Update wifi event macro name diff --git a/examples/Shield/S7XG/S7xG_LoRa/S7xG_LoRa.ino b/examples/Shield/S7XG/S7xG_LoRa/S7xG_LoRa.ino index 4784f6a..ce2c20a 100644 --- a/examples/Shield/S7XG/S7xG_LoRa/S7xG_LoRa.ino +++ b/examples/Shield/S7XG/S7xG_LoRa/S7xG_LoRa.ino @@ -9,7 +9,7 @@ Ticker btnTicker; uint32_t state = 0, prev_state = 0; bool isInit = false; lv_obj_t *btn2, *btn1, *btn3, *ta1, *gContainer; - +bool sdOnline = false; void createWin(); void stop_prev(); @@ -172,6 +172,7 @@ void pressed() void setup(void) { + uint32_t cardSize = 0; Serial.begin(115200); ttgo = TTGOClass::getWatch(); @@ -179,6 +180,18 @@ void setup(void) ttgo->tft->fillScreen(TFT_BLACK); ttgo->openBL(); + + if (ttgo->sdcard_begin()) { + Serial.println("SDCard begin SUCCESS!"); + cardSize = SD.cardSize() / (1024 * 1024); + Serial.print("setupSDCard PASS . SIZE = "); + Serial.print(cardSize); + Serial.println(" MB"); + sdOnline = true; + } else { + Serial.println("SDCard begin FAILED!"); + } + ttgo->lvgl_begin(); //! Open s7xg chip power @@ -200,6 +213,15 @@ void setup(void) lv_label_set_text(label, "Begin S7xG"); lv_obj_align(label, NULL, LV_ALIGN_CENTER, 0, 0); + lv_obj_t *label1 = lv_label_create(gContainer, NULL); + lv_label_set_text_fmt(label1, "SD Begin %s ", sdOnline ? "SUCCESS" : "FAILED"); + lv_obj_align(label1, label, LV_ALIGN_OUT_BOTTOM_MID, 0, 0); + + if (sdOnline) { + label = lv_label_create(gContainer, NULL); + lv_label_set_text_fmt(label, "SDCard:[%u] MB", cardSize); + lv_obj_align(label, label1, LV_ALIGN_OUT_BOTTOM_MID, 0, 0); + } int len = 0; int retry = 0; do { diff --git a/examples/Shield/S7XG/S7xG_LoRa/config.h b/examples/Shield/S7XG/S7xG_LoRa/config.h index 6b3b507..5cd9c7f 100644 --- a/examples/Shield/S7XG/S7xG_LoRa/config.h +++ b/examples/Shield/S7XG/S7xG_LoRa/config.h @@ -1,5 +1,5 @@ // => Hardware select -// #define LILYGO_WATCH_2019_WITH_TOUCH // To use T-Watch2019 with touchscreen, please uncomment this line +#define LILYGO_WATCH_2019_WITH_TOUCH // To use T-Watch2019 with touchscreen, please uncomment this line // #define LILYGO_WATCH_2019_NO_TOUCH // To use T-Watch2019 Not touchscreen , please uncomment this line // #define LILYGO_WATCH_BLOCK // To use T-Watch Block , please uncomment this line diff --git a/src/TTGO.h b/src/TTGO.h index 9f2aca9..a17cec7 100644 --- a/src/TTGO.h +++ b/src/TTGO.h @@ -15,6 +15,10 @@ Written by Lewis he //https://github.com/lewisxhe #include +#if defined(LILYGO_WATCH_HAS_S76_S78G) +#define LILYGO_WATCH_HAS_SDCARD +#endif + #ifdef LILYGO_WATCH_LVGL #include #endif @@ -930,6 +934,8 @@ public: } #endif + + #ifdef LILYGO_WATCH_HAS_SDCARD SPIClass *sdhander = nullptr;