diff --git a/examples/companion_radio/ui-new/UITask.cpp b/examples/companion_radio/ui-new/UITask.cpp index 8077627f8..e5e3db8db 100644 --- a/examples/companion_radio/ui-new/UITask.cpp +++ b/examples/companion_radio/ui-new/UITask.cpp @@ -689,7 +689,7 @@ void UITask::shutdown(bool restart){ _board->reboot(); } else { _display->turnOff(); - radio_driver.powerOff(); + //radio_driver.powerOff(); _board->powerOff(); } } diff --git a/examples/simple_secure_chat_ui/main.cpp b/examples/simple_secure_chat_ui/main.cpp index 9a2de79a5..bf749a399 100644 --- a/examples/simple_secure_chat_ui/main.cpp +++ b/examples/simple_secure_chat_ui/main.cpp @@ -79,7 +79,9 @@ UIManager *uiManager; SemaphoreHandle_t semaphoreData; TwoWire I2Cone = TwoWire(0); +#ifndef SEEED_SENSECAP_INDICATOR Adafruit_SSD1306 display = Adafruit_SSD1306(128, 64, &I2Cone, OLED_RESET); +#endif SPIClass& spi = SPI; uint16_t touchCalibration_x0 = 300, touchCalibration_x1 = 3600, touchCalibration_y0 = 300, touchCalibration_y1 = 3600; @@ -135,34 +137,50 @@ void my_disp_flush(lv_disp_drv_t *disp, const lv_area_t *area, lv_color_t *color } -void my_touchpad_read(lv_indev_drv_t *indev_driver, lv_indev_data_t *data) +void my_touchpad_read(lv_indev_drv_t * indev_driver, lv_indev_data_t * data) { - if (touch_has_signal()) + uint16_t x, y; + + if (lcd.getTouch(&x, &y)) { - if (touch_touched()) - { - data->state = LV_INDEV_STATE_PR; - - /*Set the coordinates*/ - data->point.x = touch_last_x; - data->point.y = touch_last_y; - // #ifndef MODE_RELEASE - // Serial.printf("Data x: %d, Data y: %d", touch_last_x, touch_last_y); - // Serial.println(); - // #endif - } - else if (touch_released()) - { - data->state = LV_INDEV_STATE_REL; - } + data->state = LV_INDEV_STATE_PR; + data->point.x = x; + data->point.y = y; } else { data->state = LV_INDEV_STATE_REL; } - delay(15); } +// void my_touchpad_read(lv_indev_drv_t *indev_driver, lv_indev_data_t *data) +// { +// if (touch_has_signal()) +// { +// if (touch_touched()) +// { +// data->state = LV_INDEV_STATE_PR; + +// /*Set the coordinates*/ +// data->point.x = touch_last_x; +// data->point.y = touch_last_y; +// // #ifndef MODE_RELEASE +// // Serial.printf("Data x: %d, Data y: %d", touch_last_x, touch_last_y); +// // Serial.println(); +// // #endif +// } +// else if (touch_released()) +// { +// data->state = LV_INDEV_STATE_REL; +// } +// } +// else +// { +// data->state = LV_INDEV_STATE_REL; +// } +// delay(15); +// } + void initializeUI() { Serial.println("initialize UI..."); @@ -779,6 +797,7 @@ void initializeDisplay() { lcd.begin(); lcd.fillScreen(0x000000u); lcd.setTextSize(2); + lcd.setRotation(1); //lcd.setBrightness(127); } diff --git a/examples/simple_secure_chat_ui/uiManager.cpp b/examples/simple_secure_chat_ui/uiManager.cpp index ead18392a..3c6db7053 100644 --- a/examples/simple_secure_chat_ui/uiManager.cpp +++ b/examples/simple_secure_chat_ui/uiManager.cpp @@ -582,6 +582,7 @@ void UIManager::scroll_begin_event(lv_event_t *e) void UIManager::ui_Screen1_screen_init(void) { + //lv_disp_set_rotation(disp, LV_DISP_ROT_90); //ui_Screen1 = lv_obj_create(NULL); ui_Screen1 = LvObj(NULL) @@ -591,7 +592,7 @@ void UIManager::ui_Screen1_screen_init(void) LvTabView tabView(ui_Screen1); tabView - .size(800, 480) + .size(480, 480) .align(LV_ALIGN_CENTER) .bgColor(0x000000) .contentNoScroll() @@ -776,7 +777,7 @@ void UIManager::ui_Screen1_screen_init(void) lv_obj_center(iu_SendLabel); ui_Keyboard = LvKeyboard(lv_layer_top()) - .size(800, 200) + .size(480, 200) .align(LV_ALIGN_BOTTOM_MID) .show(false) .onEvent(s_onKeyboardEvent, this); diff --git a/include/lgfx.h b/include/lgfx.h index b64ac1a9b..95cadb548 100644 --- a/include/lgfx.h +++ b/include/lgfx.h @@ -6,6 +6,7 @@ #include #include +#ifndef SEEED_SENSECAP_INDICATOR class LGFX : public lgfx::LGFX_Device { public: @@ -205,10 +206,12 @@ public: _panel_instance.setBus(&_bus_instance); setPanel(&_panel_instance); } + #elif defined(SEEED_SENSECAP_INDICATOR) + #else #error "No Display size defined!" #endif }; - +#endif #endif \ No newline at end of file diff --git a/include/uiTouch.h b/include/uiTouch.h index 80a5cbe42..8e60b927d 100644 --- a/include/uiTouch.h +++ b/include/uiTouch.h @@ -17,16 +17,16 @@ // #define TOUCH_MAP_Y2 480 /* uncomment for GT911 */ - #define TOUCH_GT911 - #define TOUCH_GT911_SCL 20//20 - #define TOUCH_GT911_SDA 19//19 - #define TOUCH_GT911_INT -1//-1 - #define TOUCH_GT911_RST -1//38 - #define TOUCH_GT911_ROTATION ROTATION_NORMAL - #define TOUCH_MAP_X1 800//480 - #define TOUCH_MAP_X2 0 - #define TOUCH_MAP_Y1 480//272 - #define TOUCH_MAP_Y2 0 +// #define TOUCH_GT911 +// #define TOUCH_GT911_SCL 20//20 +// #define TOUCH_GT911_SDA 19//19 +// #define TOUCH_GT911_INT -1//-1 +// #define TOUCH_GT911_RST -1//38 +// #define TOUCH_GT911_ROTATION ROTATION_NORMAL +// #define TOUCH_MAP_X1 800//480 +// #define TOUCH_MAP_X2 0 +// #define TOUCH_MAP_Y1 480//272 +// #define TOUCH_MAP_Y2 0 /* uncomment for XPT2046 */ // #define TOUCH_XPT2046 diff --git a/partition-table-8MB.csv b/partition-table-8MB.csv new file mode 100644 index 000000000..0bfbc22ba --- /dev/null +++ b/partition-table-8MB.csv @@ -0,0 +1,7 @@ +# This is a layout for 8MB of flash for MUI devices +# Name, Type, SubType, Offset, Size, Flags +nvs, data, nvs, 0x9000, 0x5000, +otadata, data, ota, 0xe000, 0x2000, +app0, app, ota_0, 0x10000, 0x5C0000, +flashApp, app, ota_1, 0x5D0000,0x0A0000, +spiffs, data, spiffs, 0x670000,0x180000 \ No newline at end of file diff --git a/platformio.ini b/platformio.ini index 743e357af..0a6a04635 100644 --- a/platformio.ini +++ b/platformio.ini @@ -24,9 +24,10 @@ lib_deps = melopero/Melopero RV3028 @ ^1.1.0 electroniccats/CayenneLPP @ 1.6.1 build_flags = -w -DNDEBUG -DRADIOLIB_STATIC_ONLY=1 -DRADIOLIB_GODMODE=1 - -D LORA_FREQ=869.525 - -D LORA_BW=250 - -D LORA_SF=11 + -D LORA_FREQ=869.618 + -D LORA_BW=62.5 + -D LORA_SF=8 + -D LORA_CR=8 -D ENABLE_ADVERT_ON_BOOT=1 -D ENABLE_PRIVATE_KEY_IMPORT=1 ; NOTE: comment these out for more secure firmware -D ENABLE_PRIVATE_KEY_EXPORT=1 diff --git a/src/helpers/esp32/ESPNOWRadio.cpp b/src/helpers/esp32/ESPNOWRadio.cpp index d336affc1..e8a143e06 100644 --- a/src/helpers/esp32/ESPNOWRadio.cpp +++ b/src/helpers/esp32/ESPNOWRadio.cpp @@ -3,6 +3,14 @@ #include #include + static uint8_t broadcastAddress[] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}; + static esp_now_peer_info_t peerInfo; + static volatile bool is_send_complete = false; + static esp_err_t last_send_result; + static uint8_t rx_buf[256]; + static uint8_t last_rx_len = 0; + static char bridge_secret[16]; + #ifdef CLIENT_WITHOUT_LORA static constexpr uint16_t BRIDGE_PACKET_MAGIC = 0xC03E; static const size_t MAX_ESPNOW_PACKET_SIZE = 250; @@ -18,14 +26,6 @@ static constexpr uint16_t BRIDGE_LENGTH_SIZE = sizeof(uint16_t); static constexpr uint16_t BRIDGE_CHECKSUM_SIZE = sizeof(uint16_t); - static uint8_t broadcastAddress[] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}; - static esp_now_peer_info_t peerInfo; - static volatile bool is_send_complete = false; - static esp_err_t last_send_result; - static uint8_t rx_buf[256]; - static uint8_t last_rx_len = 0; - static char bridge_secret[16]; - static void xorCrypt(uint8_t *data, size_t len) { size_t keyLen = strlen(bridge_secret); for (size_t i = 0; i < len; i++) { diff --git a/variants/sensecap_indicator-espnow/platformio.ini b/variants/sensecap_indicator-espnow/platformio.ini index e643d0339..1b33bc09f 100644 --- a/variants/sensecap_indicator-espnow/platformio.ini +++ b/variants/sensecap_indicator-espnow/platformio.ini @@ -6,7 +6,7 @@ board_build.flash_mode = qio board_build.psram_type = opi board_upload.flash_size = 8MB board_upload.maximum_size = 8388608 -board_build.partitions = default.csv +board_build.partitions = partition-table-8MB.csv build_flags = ${esp32_base.build_flags} -D PIN_BOARD_SDA=39 @@ -36,15 +36,30 @@ lib_deps=${esp32_base.lib_deps} extends =SenseCapIndicator-ESPNow build_flags = ${SenseCapIndicator-ESPNow.build_flags} - -I examples/companion_radio/ui-new + ; -I examples/companion_radio/ui-new -D MAX_CONTACTS=350 -D MAX_GROUP_CHANNELS=40 + -D CORE_DEBUG_LEVEL=4 ; 0: None, 1: Error, 2: Warn, 3: Info, 4: Debug, 5: Verbose + -D LV_CONF_PATH=lv_conf.h + -D SEEED_SENSECAP_INDICATOR + -D LANG_GR + -D ADVERT_NAME='"SenseCap Client"' + -D MAX_CONTACTS=350 + -D MAX_GROUP_CHANNELS=8 + -D MESH_DEBUG=1 ; NOTE: DO NOT ENABLE --> -D MESH_PACKET_LOGGING=1 ; NOTE: DO NOT ENABLE --> -D MESH_DEBUG=1 ; NOTE: DO NOT ENABLE --> -D ESPNOW_DEBUG_LOGGING=1 build_src_filter = ${SenseCapIndicator-ESPNow.build_src_filter} - +<../examples/companion_radio/ui-new/*.cpp> - +<../examples/companion_radio/*.cpp> + +<../examples/simple_secure_chat_ui/*.cpp> + + + + lib_deps = ${SenseCapIndicator-ESPNow.lib_deps} - densaugeo/base64 @ ~1.4.0 \ No newline at end of file + adafruit/Adafruit SSD1306 @ ^2.5.15 + fbiego/ESP32Time@^2.0.6 + lvgl/lvgl@8.3.11 + lovyan03/LovyanGFX@^1.1.16 + bitbank2/PNGdec@^1.1.6 + ;tamctec/TAMC_GT911@^1.0.2 + densaugeo/base64 @ ~1.4.0