diff --git a/.trunk/trunk.yaml b/.trunk/trunk.yaml index 71d37bc2e..8f938ce9e 100644 --- a/.trunk/trunk.yaml +++ b/.trunk/trunk.yaml @@ -12,7 +12,7 @@ lint: - trufflehog@3.88.18 - yamllint@1.37.0 - bandit@1.8.3 - - checkov@3.2.392 + - checkov@3.2.394 - terrascan@1.19.9 - trivy@0.60.0 - taplo@0.9.3 diff --git a/arch/esp32/esp32.ini b/arch/esp32/esp32.ini index 256781ba1..df3778002 100644 --- a/arch/esp32/esp32.ini +++ b/arch/esp32/esp32.ini @@ -45,11 +45,11 @@ lib_deps = ${networking_base.lib_deps} ${environmental_base.lib_deps} ${radiolib_base.lib_deps} - https://github.com/meshtastic/esp32_https_server.git#23665b3adc080a311dcbb586ed5941b5f94d6ea2 + https://github.com/meshtastic/esp32_https_server/archive/23665b3adc080a311dcbb586ed5941b5f94d6ea2.zip h2zero/NimBLE-Arduino@^1.4.3 - https://github.com/dbinfrago/libpax.git#3cdc0371c375676a97967547f4065607d4c53fd1 + https://github.com/dbinfrago/libpax/archive/3cdc0371c375676a97967547f4065607d4c53fd1.zip lewisxhe/XPowersLib@^0.2.7 - https://github.com/meshtastic/ESP32_Codec2.git#633326c78ac251c059ab3a8c430fcdf25b41672f + https://github.com/meshtastic/ESP32_Codec2/archive/633326c78ac251c059ab3a8c430fcdf25b41672f.zip rweather/Crypto@^0.4.0 lib_ignore = diff --git a/arch/esp32/esp32c6.ini b/arch/esp32/esp32c6.ini index d0425812f..dba3bac08 100644 --- a/arch/esp32/esp32c6.ini +++ b/arch/esp32/esp32c6.ini @@ -1,6 +1,6 @@ [esp32c6_base] extends = esp32_base -platform = https://github.com/Jason2866/platform-espressif32.git#22faa566df8c789000f8136cd8d0aca49617af55 +platform = https://github.com/Jason2866/platform-espressif32/archive/22faa566df8c789000f8136cd8d0aca49617af55.zip build_flags = ${arduino_base.build_flags} -Wall @@ -25,7 +25,7 @@ lib_deps = ${environmental_base.lib_deps} ${radiolib_base.lib_deps} lewisxhe/XPowersLib@^0.2.7 - https://github.com/meshtastic/ESP32_Codec2.git#633326c78ac251c059ab3a8c430fcdf25b41672f + https://github.com/meshtastic/ESP32_Codec2/archive/633326c78ac251c059ab3a8c430fcdf25b41672f.zip rweather/Crypto@^0.4.0 build_src_filter = diff --git a/arch/nrf52/nrf52.ini b/arch/nrf52/nrf52.ini index d4e88af1f..ca12be6b1 100644 --- a/arch/nrf52/nrf52.ini +++ b/arch/nrf52/nrf52.ini @@ -1,10 +1,10 @@ [nrf52_base] ; Instead of the standard nordicnrf52 platform, we use our fork which has our added variant files -platform = platformio/nordicnrf52@^10.7.0 +platform = platformio/nordicnrf52@^10.8.0 extends = arduino_base platform_packages = ; our custom Git version until they merge our PR - platformio/framework-arduinoadafruitnrf52 @ https://github.com/meshtastic/Adafruit_nRF52_Arduino.git#e13f5820002a4fb2a5e6754b42ace185277e5adf + platformio/framework-arduinoadafruitnrf52 @ https://github.com/meshtastic/Adafruit_nRF52_Arduino#e13f5820002a4fb2a5e6754b42ace185277e5adf platformio/toolchain-gccarmnoneeabi@~1.90301.0 build_type = debug diff --git a/arch/nrf52/nrf52840.ini b/arch/nrf52/nrf52840.ini index a13a600f3..0dab5d9ba 100644 --- a/arch/nrf52/nrf52840.ini +++ b/arch/nrf52/nrf52840.ini @@ -6,7 +6,7 @@ build_flags = ${nrf52_base.build_flags} lib_deps = ${nrf52_base.lib_deps} ${environmental_base.lib_deps} - https://github.com/Kongduino/Adafruit_nRFCrypto.git#e31a8825ea3300b163a0a3c1ddd5de34e10e1371 + https://github.com/Kongduino/Adafruit_nRFCrypto/archive/e31a8825ea3300b163a0a3c1ddd5de34e10e1371.zip ; Common NRF52 debugging settings follow. See the Meshtastic developer docs for how to connect SWD debugging probes to your board. diff --git a/arch/portduino/portduino.ini b/arch/portduino/portduino.ini index 55234914f..e0488aeff 100644 --- a/arch/portduino/portduino.ini +++ b/arch/portduino/portduino.ini @@ -1,6 +1,6 @@ ; The Portduino based 'native' environment. Currently supported on Linux targets with real LoRa hardware (or simulated). [portduino_base] -platform = https://github.com/meshtastic/platform-native.git#e82ba1a19b6cd1dc55cbde29b33ea8dd0640014f +platform = https://github.com/meshtastic/platform-native/archive/c5bd469ab9b5a6966321e09557b27d906961da63.zip framework = arduino build_src_filter = @@ -26,7 +26,7 @@ lib_deps = ${radiolib_base.lib_deps} rweather/Crypto@^0.4.0 lovyan03/LovyanGFX@^1.2.0 - https://github.com/pine64/libch341-spi-userspace#a9b17e3452f7fb747000d9b4ad4409155b39f6ef + https://github.com/pine64/libch341-spi-userspace/archive/a9b17e3452f7fb747000d9b4ad4409155b39f6ef.zip build_flags = ${arduino_base.build_flags} diff --git a/arch/rp2xx0/rp2040.ini b/arch/rp2xx0/rp2040.ini index 1542dbee7..33fcfb211 100644 --- a/arch/rp2xx0/rp2040.ini +++ b/arch/rp2xx0/rp2040.ini @@ -1,8 +1,8 @@ ; Common settings for rp2040 Processor based targets [rp2040_base] -platform = https://github.com/maxgerhardt/platform-raspberrypi.git#76ecf3c7e9dd4503af0331154c4ca1cddc4b03e5 ; For arduino-pico >= 4.4.3 +platform = https://github.com/maxgerhardt/platform-raspberrypi#76ecf3c7e9dd4503af0331154c4ca1cddc4b03e5 ; For arduino-pico >= 4.4.3 extends = arduino_base -platform_packages = framework-arduinopico@https://github.com/earlephilhower/arduino-pico.git#4.4.3 +platform_packages = framework-arduinopico@https://github.com/earlephilhower/arduino-pico#4.4.3 board_build.core = earlephilhower board_build.filesystem_size = 0.5m diff --git a/arch/rp2xx0/rp2350.ini b/arch/rp2xx0/rp2350.ini index 6f1e4400e..841035c80 100644 --- a/arch/rp2xx0/rp2350.ini +++ b/arch/rp2xx0/rp2350.ini @@ -1,8 +1,8 @@ ; Common settings for rp2040 Processor based targets [rp2350_base] -platform = https://github.com/maxgerhardt/platform-raspberrypi.git#76ecf3c7e9dd4503af0331154c4ca1cddc4b03e5 ; For arduino-pico >= 4.4.3 +platform = https://github.com/maxgerhardt/platform-raspberrypi#76ecf3c7e9dd4503af0331154c4ca1cddc4b03e5 ; For arduino-pico >= 4.4.3 extends = arduino_base -platform_packages = framework-arduinopico@https://github.com/earlephilhower/arduino-pico.git#4.4.3 +platform_packages = framework-arduinopico@https://github.com/earlephilhower/arduino-pico#4.4.3 board_build.core = earlephilhower board_build.filesystem_size = 0.5m diff --git a/arch/stm32/stm32.ini b/arch/stm32/stm32.ini index d5e615f5f..c1b58bb82 100644 --- a/arch/stm32/stm32.ini +++ b/arch/stm32/stm32.ini @@ -1,7 +1,7 @@ [stm32_base] extends = arduino_base platform = ststm32 -platform_packages = platformio/framework-arduinoststm32@https://github.com/stm32duino/Arduino_Core_STM32.git#2.9.0 +platform_packages = platformio/framework-arduinoststm32@https://github.com/stm32duino/Arduino_Core_STM32/archive/2.10.1.zip extra_scripts = ${env.extra_scripts} post:extra_scripts/extra_stm32.py @@ -35,7 +35,7 @@ debug_tool = stlink lib_deps = ${env.lib_deps} ${radiolib_base.lib_deps} - https://github.com/caveman99/Crypto.git#eae9c768054118a9399690f8af202853d1ae8516 + https://github.com/caveman99/Crypto/archive/eae9c768054118a9399690f8af202853d1ae8516.zip lib_ignore = mathertel/OneButton@2.6.1 diff --git a/boards/ThinkNode-M1.json b/boards/ThinkNode-M1.json new file mode 100644 index 000000000..e55da3ec7 --- /dev/null +++ b/boards/ThinkNode-M1.json @@ -0,0 +1,53 @@ +{ + "build": { + "arduino": { + "ldscript": "nrf52840_s140_v6.ld" + }, + "core": "nRF5", + "cpu": "cortex-m4", + "extra_flags": "-DARDUINO_NRF52840_TTGO_EINK -DNRF52840_XXAA", + "f_cpu": "64000000L", + "hwids": [ + ["0x239A", "0x4405"], + ["0x239A", "0x0029"], + ["0x239A", "0x002A"] + ], + "usb_product": "elecrow_eink", + "mcu": "nrf52840", + "variant": "ELECROW-ThinkNode-M1", + "variants_dir": "variants", + "bsp": { + "name": "adafruit" + }, + "softdevice": { + "sd_flags": "-DS140", + "sd_name": "s140", + "sd_version": "6.1.1", + "sd_fwid": "0x00B6" + }, + "bootloader": { + "settings_addr": "0xFF000" + } + }, + "connectivity": ["bluetooth"], + "debug": { + "jlink_device": "nRF52840_xxAA", + "onboard_tools": ["jlink"], + "svd_path": "nrf52840.svd", + "openocd_target": "nrf52840-mdk-rs" + }, + "frameworks": ["arduino"], + "name": "elecrow eink", + "upload": { + "maximum_ram_size": 248832, + "maximum_size": 815104, + "speed": 115200, + "protocol": "nrfutil", + "protocols": ["jlink", "nrfjprog", "nrfutil", "stlink"], + "use_1200bps_touch": true, + "require_upload_port": true, + "wait_for_upload_port": true + }, + "url": "FIXME", + "vendor": "ELECROW" +} diff --git a/platformio.ini b/platformio.ini index 3de5b715f..010aea90f 100644 --- a/platformio.ini +++ b/platformio.ini @@ -56,11 +56,11 @@ build_flags = -Wno-missing-field-initializers monitor_speed = 115200 monitor_filters = direct lib_deps = - https://github.com/meshtastic/esp8266-oled-ssd1306.git#e16cee124fe26490cb14880c679321ad8ac89c95 + https://github.com/meshtastic/esp8266-oled-ssd1306/archive/e16cee124fe26490cb14880c679321ad8ac89c95.zip mathertel/OneButton@2.6.1 - https://github.com/meshtastic/arduino-fsm.git#7db3702bf0cfe97b783d6c72595e3f38e0b19159 - https://github.com/meshtastic/TinyGPSPlus.git#71a82db35f3b973440044c476d4bcdc673b104f4 - https://github.com/meshtastic/ArduinoThread.git#7c3ee9e1951551b949763b1f5280f8db1fa4068d + https://github.com/meshtastic/arduino-fsm/archive/7db3702bf0cfe97b783d6c72595e3f38e0b19159.zip + https://github.com/meshtastic/TinyGPSPlus/archive/71a82db35f3b973440044c476d4bcdc673b104f4.zip + https://github.com/meshtastic/ArduinoThread/archive/7c3ee9e1951551b949763b1f5280f8db1fa4068d.zip nanopb/Nanopb@0.4.91 erriez/ErriezCRC32@1.0.1 @@ -94,18 +94,18 @@ lib_deps = [device-ui_base] lib_deps = - https://github.com/meshtastic/device-ui.git#7a6ffba3c86901b0e3234b6c056aa803b4cd8854 + https://github.com/meshtastic/device-ui/archive/99171e87a70452395b56cce713a951c1c2964370.zip ; Common libs for environmental measurements in telemetry module ; (not included in native / portduino) [environmental_base] lib_deps = - adafruit/Adafruit BusIO@1.16.2 - adafruit/Adafruit Unified Sensor@1.1.14 + adafruit/Adafruit BusIO@1.17.0 + adafruit/Adafruit Unified Sensor@1.1.15 adafruit/Adafruit BMP280 Library@2.6.8 adafruit/Adafruit BMP085 Library@1.2.4 adafruit/Adafruit BME280 Library@2.2.4 - adafruit/Adafruit BMP3XX Library@2.1.5 + adafruit/Adafruit BMP3XX Library@2.1.6 adafruit/Adafruit DPS310@1.1.5 adafruit/Adafruit MCP9808 Library@2.0.2 adafruit/Adafruit INA260 Library@1.5.2 @@ -114,27 +114,27 @@ lib_deps = adafruit/Adafruit SHTC3 Library@1.0.1 adafruit/Adafruit LPS2X@2.0.6 adafruit/Adafruit SHT31 Library@2.2.2 - adafruit/Adafruit PM25 AQI Sensor@1.1.1 + adafruit/Adafruit PM25 AQI Sensor@1.2.0 adafruit/Adafruit MPU6050@2.2.6 adafruit/Adafruit LIS3DH@1.3.0 adafruit/Adafruit AHTX0@2.0.5 - adafruit/Adafruit LSM6DS@4.7.3 + adafruit/Adafruit LSM6DS@4.7.4 adafruit/Adafruit VEML7700 Library@2.1.6 adafruit/Adafruit SHT4x Library@1.0.5 adafruit/Adafruit TSL2591 Library@1.4.5 sparkfun/SparkFun Qwiic Scale NAU7802 Arduino Library@1.0.6 - sparkfun/SparkFun 9DoF IMU Breakout - ICM 20948 - Arduino Library@1.2.13 + sparkfun/SparkFun 9DoF IMU Breakout - ICM 20948 - Arduino Library@1.3.0 ClosedCube OPT3001@1.1.2 emotibit/EmotiBit MLX90632@1.0.8 adafruit/Adafruit MLX90614 Library@2.1.5 - https://github.com/boschsensortec/Bosch-BSEC2-Library#v1.7.2502 + https://github.com/boschsensortec/Bosch-BSEC2-Library/archive/v1.7.2502.zip boschsensortec/BME68x Sensor Library@1.1.40407 - https://github.com/KodinLanewave/INA3221@1.0.1 + https://github.com/KodinLanewave/INA3221/archive/1.0.1.zip mprograms/QMC5883LCompass@1.2.3 dfrobot/DFRobot_RTU@1.0.3 - https://github.com/meshtastic/DFRobot_LarkWeatherStation#4de3a9cadef0f6a5220a8a906cf9775b02b0040d - https://github.com/DFRobot/DFRobot_RainfallSensor#38fea5e02b40a5430be6dab39a99a6f6347d667e - robtillaart/INA226@0.6.0 + https://github.com/meshtastic/DFRobot_LarkWeatherStation/archive/4de3a9cadef0f6a5220a8a906cf9775b02b0040d.zip + https://github.com/DFRobot/DFRobot_RainfallSensor/archive/38fea5e02b40a5430be6dab39a99a6f6347d667e.zip + robtillaart/INA226@0.6.4 ; Health Sensor Libraries sparkfun/SparkFun MAX3010x Pulse and Proximity Sensor Library@1.1.2 diff --git a/protobufs b/protobufs index b4044f8f9..484d002a5 160000 --- a/protobufs +++ b/protobufs @@ -1 +1 @@ -Subproject commit b4044f8f9f3681d4d20521dbe13ee42c96eae353 +Subproject commit 484d002a52bc20fa9f91ebf1b216d585c5f93a1b diff --git a/src/ButtonThread.cpp b/src/ButtonThread.cpp index 12f81353c..2363f804c 100644 --- a/src/ButtonThread.cpp +++ b/src/ButtonThread.cpp @@ -73,23 +73,28 @@ ButtonThread::ButtonThread() : OSThread("Button") userButton.setDebounceMs(1); userButton.attachDoubleClick(userButtonDoublePressed); userButton.attachMultiClick(userButtonMultiPressed, this); // Reference to instance: get click count from non-static OneButton -#ifndef T_DECK // T-Deck immediately wakes up after shutdown, so disable this function +#if !defined(T_DECK) && \ + !defined( \ + ELECROW_ThinkNode_M2) // T-Deck immediately wakes up after shutdown, Thinknode M2 has this on the smaller ALT button userButton.attachLongPressStart(userButtonPressedLongStart); userButton.attachLongPressStop(userButtonPressedLongStop); #endif #endif #ifdef BUTTON_PIN_ALT - userButtonAlt = OneButton(BUTTON_PIN_ALT, true, true); +#if defined(ELECROW_ThinkNode_M2) + this->userButtonAlt = OneButton(BUTTON_PIN_ALT, false, false); +#else + this->userButtonAlt = OneButton(BUTTON_PIN_ALT, true, true); +#endif #ifdef INPUT_PULLUP_SENSE // Some platforms (nrf52) have a SENSE variant which allows wake from sleep - override what OneButton did pinMode(BUTTON_PIN_ALT, INPUT_PULLUP_SENSE); #endif - userButtonAlt.attachClick(userButtonPressed); + userButtonAlt.attachClick(userButtonPressedScreen); userButtonAlt.setClickMs(BUTTON_CLICK_MS); userButtonAlt.setPressMs(BUTTON_LONGPRESS_MS); userButtonAlt.setDebounceMs(1); - userButtonAlt.attachDoubleClick(userButtonDoublePressed); userButtonAlt.attachLongPressStart(userButtonPressedLongStart); userButtonAlt.attachLongPressStop(userButtonPressedLongStop); #endif @@ -117,6 +122,40 @@ int32_t ButtonThread::runOnce() canSleep = true; // Assume we should not keep the board awake #if defined(BUTTON_PIN) || defined(USERPREFS_BUTTON_PIN) + // #if defined(ELECROW_ThinkNode_M1) || defined(ELECROW_ThinkNode_M2) + // buzzer_updata(); + // if (buttonPressed) { + // buttonPressed = false; // 清除标志 + // LOG_INFO("PIN_BUTTON2 pressed!"); // 串口打印信息 + // // off_currentTime = millis(); + // while (digitalRead(PIN_BUTTON2) == HIGH) { + // if (cont < 40) { + // // unsigned long currentTime = millis(); // 获取当前时间 + // // if (currentTime - off_currentTime >= 1000) { + // cont++; + // // off_currentTime = currentTime; + // // } + // delay(100); + // } else { + + // currentState = OFF; + // isBuzzing = false; + // cont = 0; + // BEEP_STATE = false; + // analogWrite(M2_buzzer, 0); + // pinMode(M2_buzzer, INPUT); + // screen->setOn(false); + // cont = 0; + // LOG_INFO("GGGGGGGGGGGGGGGGGGGGGGGGG"); + // pinMode(1, OUTPUT); + // digitalWrite(1, LOW); + // pinMode(6, OUTPUT); + // digitalWrite(6, LOW); + // } + // } + // } + + // #endif userButton.tick(); canSleep &= userButton.isIdle(); #elif defined(ARCH_PORTDUINO) @@ -166,6 +205,14 @@ int32_t ButtonThread::runOnce() break; } + case BUTTON_EVENT_PRESSED_SCREEN: { + // turn screen on or off + screen_flag = !screen_flag; + if (screen) + screen->setOn(screen_flag); + break; + } + case BUTTON_EVENT_DOUBLE_PRESSED: { LOG_BUTTON("Double press!"); service->refreshLocalMeshNode(); @@ -192,7 +239,16 @@ int32_t ButtonThread::runOnce() screen->forceDisplay(true); // Force a new UI frame, then force an EInk update } break; +#elif defined(ELECROW_ThinkNode_M2) + case 3: + LOG_INFO("3 clicks: toggle buzzer"); + buzzer_flag = !buzzer_flag; + if (buzzer_flag) { + playBeep(); + } + break; #endif + #if defined(USE_EINK) && defined(PIN_EINK_EN) // i.e. T-Echo // 4 clicks: toggle backlight case 4: diff --git a/src/ButtonThread.h b/src/ButtonThread.h index 54b833d03..a8f1f77c3 100644 --- a/src/ButtonThread.h +++ b/src/ButtonThread.h @@ -24,6 +24,7 @@ class ButtonThread : public concurrency::OSThread enum ButtonEventType { BUTTON_EVENT_NONE, BUTTON_EVENT_PRESSED, + BUTTON_EVENT_PRESSED_SCREEN, BUTTON_EVENT_DOUBLE_PRESSED, BUTTON_EVENT_MULTI_PRESSED, BUTTON_EVENT_LONG_PRESSED, @@ -42,7 +43,6 @@ class ButtonThread : public concurrency::OSThread int beforeLightSleep(void *unused); int afterLightSleep(esp_sleep_wakeup_cause_t cause); #endif - private: #if defined(BUTTON_PIN) || defined(ARCH_PORTDUINO) || defined(USERPREFS_BUTTON_PIN) static OneButton userButton; // Static - accessed from an interrupt @@ -64,6 +64,8 @@ class ButtonThread : public concurrency::OSThread // set during IRQ static volatile ButtonEventType btnEvent; + bool buzzer_flag = false; + bool screen_flag = true; // Store click count during callback, for later use volatile int multipressClickCount = 0; @@ -72,6 +74,12 @@ class ButtonThread : public concurrency::OSThread // IRQ callbacks static void userButtonPressed() { btnEvent = BUTTON_EVENT_PRESSED; } + static void userButtonPressedScreen() + { + if (millis() > c_holdOffTime) { + btnEvent = BUTTON_EVENT_PRESSED_SCREEN; + } + } static void userButtonDoublePressed() { btnEvent = BUTTON_EVENT_DOUBLE_PRESSED; } static void userButtonMultiPressed(void *callerThread); // Retrieve click count from non-static Onebutton while still valid static void userButtonPressedLongStart(); diff --git a/src/Power.cpp b/src/Power.cpp index 8c2ef998d..0dec0fc21 100644 --- a/src/Power.cpp +++ b/src/Power.cpp @@ -533,6 +533,9 @@ Power::Power() : OSThread("Power") { statusHandler = {}; low_voltage_counter = 0; +#if defined(ELECROW_ThinkNode_M1) || defined(POWER_CFG) + low_voltage_counter_led3 = 0; +#endif #ifdef DEBUG_HEAP lastheap = memGet.getFreeHeap(); #endif @@ -668,12 +671,12 @@ void Power::readPowerStatus() int8_t batteryChargePercent = -1; OptionalBool usbPowered = OptUnknown; OptionalBool hasBattery = OptUnknown; // These must be static because NRF_APM code doesn't run every time - OptionalBool isCharging = OptUnknown; + OptionalBool isChargingNow = OptUnknown; if (batteryLevel) { hasBattery = batteryLevel->isBatteryConnect() ? OptTrue : OptFalse; usbPowered = batteryLevel->isVbusIn() ? OptTrue : OptFalse; - isCharging = batteryLevel->isCharging() ? OptTrue : OptFalse; + isChargingNow = batteryLevel->isCharging() ? OptTrue : OptFalse; if (hasBattery) { batteryVoltageMv = batteryLevel->getBattVoltage(); // If the AXP192 returns a valid battery percentage, use it @@ -702,17 +705,20 @@ void Power::readPowerStatus() // If changed to DISCONNECTED if (nrf_usb_state == NRFX_POWER_USB_STATE_DISCONNECTED) - isCharging = usbPowered = OptFalse; + isChargingNow = usbPowered = OptFalse; // If changed to CONNECTED / READY else - isCharging = usbPowered = OptTrue; + isChargingNow = usbPowered = OptTrue; #endif // Notify any status instances that are observing us - const PowerStatus powerStatus2 = PowerStatus(hasBattery, usbPowered, isCharging, batteryVoltageMv, batteryChargePercent); + const PowerStatus powerStatus2 = PowerStatus(hasBattery, usbPowered, isChargingNow, batteryVoltageMv, batteryChargePercent); LOG_DEBUG("Battery: usbPower=%d, isCharging=%d, batMv=%d, batPct=%d", powerStatus2.getHasUSB(), powerStatus2.getIsCharging(), powerStatus2.getBatteryVoltageMv(), powerStatus2.getBatteryChargePercent()); +#if defined(ELECROW_ThinkNode_M1) || defined(POWER_CFG) + power_num = powerStatus2.getBatteryVoltageMv(); +#endif newStatus.notifyObservers(&powerStatus2); #ifdef DEBUG_HEAP if (lastheap != memGet.getFreeHeap()) { @@ -756,9 +762,13 @@ void Power::readPowerStatus() // If we have a battery at all and it is less than 0%, force deep sleep if we have more than 10 low readings in // a row. NOTE: min LiIon/LiPo voltage is 2.0 to 2.5V, current OCV min is set to 3100 that is large enough. // + if (batteryLevel && powerStatus2.getHasBattery() && !powerStatus2.getHasUSB()) { if (batteryLevel->getBattVoltage() < OCV[NUM_OCV_POINTS - 1]) { low_voltage_counter++; +#if defined(ELECROW_ThinkNode_M1) + low_voltage_counter_led3 = low_voltage_counter; +#endif LOG_DEBUG("Low voltage counter: %d/10", low_voltage_counter); if (low_voltage_counter > 10) { #ifdef ARCH_NRF52 @@ -771,7 +781,13 @@ void Power::readPowerStatus() } } else { low_voltage_counter = 0; +#if defined(ELECROW_ThinkNode_M1) + low_voltage_counter_led3 = low_voltage_counter; +#endif } +#ifdef POWER_CFG + low_voltage_counter_led3 = low_voltage_counter; +#endif } } diff --git a/src/buzz/buzz.cpp b/src/buzz/buzz.cpp index 8db9602bc..6ba2f4140 100644 --- a/src/buzz/buzz.cpp +++ b/src/buzz/buzz.cpp @@ -30,8 +30,11 @@ struct ToneDuration { #define NOTE_B3 247 #define NOTE_CS4 277 -const int DURATION_1_8 = 125; // 1/8 note -const int DURATION_1_4 = 250; // 1/4 note +const int DURATION_1_8 = 125; // 1/8 note +const int DURATION_1_4 = 250; // 1/4 note +const int DURATION_1_2 = 500; // 1/2 note +const int DURATION_3_4 = 750; // 1/4 note +const int DURATION_1_1 = 1000; // 1/1 note void playTones(const ToneDuration *tone_durations, int size) { @@ -55,6 +58,12 @@ void playBeep() playTones(melody, sizeof(melody) / sizeof(ToneDuration)); } +void playLongBeep() +{ + ToneDuration melody[] = {{NOTE_B3, DURATION_1_1}}; + playTones(melody, sizeof(melody) / sizeof(ToneDuration)); +} + void playGPSEnableBeep() { ToneDuration melody[] = {{NOTE_C3, DURATION_1_8}, {NOTE_FS3, DURATION_1_4}, {NOTE_CS4, DURATION_1_4}}; diff --git a/src/buzz/buzz.h b/src/buzz/buzz.h index c52c3020c..adeaca73d 100644 --- a/src/buzz/buzz.h +++ b/src/buzz/buzz.h @@ -1,6 +1,7 @@ #pragma once void playBeep(); +void playLongBeep(); void playStartMelody(); void playShutdownMelody(); void playGPSEnableBeep(); diff --git a/src/gps/GPS.cpp b/src/gps/GPS.cpp index c33cb2975..41a2ff980 100644 --- a/src/gps/GPS.cpp +++ b/src/gps/GPS.cpp @@ -981,15 +981,16 @@ void GPS::down() setPowerState(GPS_IDLE); else { - // Check whether the GPS hardware is capable of GPS_SOFTSLEEP - // If not, fallback to GPS_HARDSLEEP instead +// Check whether the GPS hardware is capable of GPS_SOFTSLEEP +// If not, fallback to GPS_HARDSLEEP instead +#ifdef PIN_GPS_STANDBY // L76B, L76K and clones have a standby pin + bool softsleepSupported = true; +#else bool softsleepSupported = false; +#endif // U-blox is supported via PMREQ if (IS_ONE_OF(gnssModel, GNSS_MODEL_UBLOX6, GNSS_MODEL_UBLOX7, GNSS_MODEL_UBLOX8, GNSS_MODEL_UBLOX9, GNSS_MODEL_UBLOX10)) softsleepSupported = true; -#ifdef PIN_GPS_STANDBY // L76B, L76K and clones have a standby pin - softsleepSupported = true; -#endif if (softsleepSupported) { // How long does gps_update_interval need to be, for GPS_HARDSLEEP to become more efficient than diff --git a/src/graphics/EInkDisplay2.cpp b/src/graphics/EInkDisplay2.cpp index 1bf1bc300..96c6b44c1 100644 --- a/src/graphics/EInkDisplay2.cpp +++ b/src/graphics/EInkDisplay2.cpp @@ -128,16 +128,24 @@ bool EInkDisplay::connect() #ifdef PIN_EINK_EN // backlight power, HIGH is backlight on, LOW is off pinMode(PIN_EINK_EN, OUTPUT); +#ifdef ELECROW_ThinkNode_M1 digitalWrite(PIN_EINK_EN, LOW); +#else + digitalWrite(PIN_EINK_EN, HIGH); +#endif #endif -#if defined(TTGO_T_ECHO) +#if defined(TTGO_T_ECHO) || defined(ELECROW_ThinkNode_M1) { auto lowLevel = new EINK_DISPLAY_MODEL(PIN_EINK_CS, PIN_EINK_DC, PIN_EINK_RES, PIN_EINK_BUSY, SPI1); adafruitDisplay = new GxEPD2_BW(*lowLevel); adafruitDisplay->init(); +#ifdef ELECROW_ThinkNode_M1 + adafruitDisplay->setRotation(4); +#else adafruitDisplay->setRotation(3); +#endif adafruitDisplay->setPartialWindow(0, 0, displayWidth, displayHeight); } #elif defined(MESHLINK) diff --git a/src/graphics/Screen.cpp b/src/graphics/Screen.cpp index 44c2d8fe4..f8c7293d9 100644 --- a/src/graphics/Screen.cpp +++ b/src/graphics/Screen.cpp @@ -1642,6 +1642,11 @@ void Screen::handleSetOn(bool on, FrameCallback einkScreensaver) setScreensaverFrames(einkScreensaver); #endif LOG_INFO("Turn off screen"); +#ifdef ELECROW_ThinkNode_M1 + if (digitalRead(PIN_EINK_EN) == HIGH) { + digitalWrite(PIN_EINK_EN, LOW); + } +#endif dispdev->displayOff(); #ifdef USE_ST7789 SPI1.end(); @@ -2668,14 +2673,19 @@ void DebugInfo::drawFrameSettings(OLEDDisplay *display, OLEDDisplayUiState *stat // minutes %= 60; // hours %= 24; + // Show uptime as days, hours, minutes OR seconds + std::string uptime = screen->drawTimeDelta(days, hours, minutes, seconds); + + // Line 1 (Still) + display->drawString(x + SCREEN_WIDTH - display->getStringWidth(uptime.c_str()), y, uptime.c_str()); + if (config.display.heading_bold) + display->drawString(x - 1 + SCREEN_WIDTH - display->getStringWidth(uptime.c_str()), y, uptime.c_str()); + display->setColor(WHITE); // Setup string to assemble analogClock string std::string analogClock = ""; - // Show uptime as days, hours, minutes OR seconds - std::string uptime = screen->drawTimeDelta(days, hours, minutes, seconds); - uint32_t rtc_sec = getValidTime(RTCQuality::RTCQualityDevice, true); // Display local timezone if (rtc_sec > 0) { long hms = rtc_sec % SEC_PER_DAY; @@ -2708,9 +2718,6 @@ void DebugInfo::drawFrameSettings(OLEDDisplay *display, OLEDDisplayUiState *stat analogClock += timebuf; } - // Line 1 - display->drawString(x + SCREEN_WIDTH - display->getStringWidth(uptime.c_str()), y, uptime.c_str()); - // Line 2 display->drawString(x, y + FONT_HEIGHT_SMALL * 1, analogClock.c_str()); @@ -2732,7 +2739,7 @@ void DebugInfo::drawFrameSettings(OLEDDisplay *display, OLEDDisplayUiState *stat drawGPSpowerstat(display, x, y + FONT_HEIGHT_SMALL * 2, gpsStatus); } #endif - /* Display a heartbeat pixel that blinks every time the frame is redrawn */ +/* Display a heartbeat pixel that blinks every time the frame is redrawn */ #ifdef SHOW_REDRAWS if (heartbeat) display->setPixel(0, 0); diff --git a/src/main.cpp b/src/main.cpp index 159933943..ada0e52de 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -262,6 +262,32 @@ void printInfo() #ifndef PIO_UNIT_TESTING void setup() { + +#ifdef POWER_CHRG + pinMode(POWER_CHRG, OUTPUT); + digitalWrite(POWER_CHRG, HIGH); +#endif + +#if defined(PIN_POWER_EN) + pinMode(PIN_POWER_EN, OUTPUT); + digitalWrite(PIN_POWER_EN, HIGH); +#endif + +#ifdef LED_POWER + pinMode(LED_POWER, OUTPUT); + digitalWrite(LED_POWER, HIGH); +#endif + +#ifdef POWER_LED + pinMode(POWER_LED, OUTPUT); + digitalWrite(POWER_LED, HIGH); +#endif + +#ifdef USER_LED + pinMode(USER_LED, OUTPUT); + digitalWrite(USER_LED, LOW); +#endif + #if defined(T_DECK) // GPIO10 manages all peripheral power supplies // Turn on peripheral power immediately after MUC starts. @@ -325,13 +351,6 @@ void setup() initDeepSleep(); - // power on peripherals -#if defined(PIN_POWER_EN) - pinMode(PIN_POWER_EN, OUTPUT); - digitalWrite(PIN_POWER_EN, HIGH); - // digitalWrite(PIN_POWER_EN1, INPUT); -#endif - #if defined(LORA_TCXO_GPIO) pinMode(LORA_TCXO_GPIO, OUTPUT); digitalWrite(LORA_TCXO_GPIO, HIGH); @@ -1304,5 +1323,4 @@ void loop() mainDelay.delay(delayMsec); } } - #endif diff --git a/src/mesh/Channels.cpp b/src/mesh/Channels.cpp index f1d4926db..4d061f80f 100644 --- a/src/mesh/Channels.cpp +++ b/src/mesh/Channels.cpp @@ -347,7 +347,7 @@ bool Channels::anyMqttEnabled() { #if USERPREFS_EVENT_MODE // Don't publish messages on the public MQTT broker if we are in event mode - if (mqtt && mqtt.isUsingDefaultServer()) { + if (mqtt && mqtt->isUsingDefaultServer()) { return false; } #endif diff --git a/src/mesh/NodeDB.cpp b/src/mesh/NodeDB.cpp index 217ff52d7..884de25f4 100644 --- a/src/mesh/NodeDB.cpp +++ b/src/mesh/NodeDB.cpp @@ -1064,8 +1064,8 @@ void NodeDB::loadFromDisk() // if (state != LoadFileResult::LOAD_SUCCESS) { // installDefaultDeviceState(); // Our in RAM copy might now be corrupt //} else { - if (devicestate.version < DEVICESTATE_MIN_VER) { - LOG_WARN("Devicestate %d is old, discard", devicestate.version); + if ((state != LoadFileResult::LOAD_SUCCESS) || (devicestate.version < DEVICESTATE_MIN_VER)) { + LOG_WARN("Devicestate %d is old or invalid, discard", devicestate.version); installDefaultDeviceState(); } else { LOG_INFO("Loaded saved devicestate version %d", devicestate.version); diff --git a/src/mesh/Router.cpp b/src/mesh/Router.cpp index 992f38ff4..b8b7ee610 100644 --- a/src/mesh/Router.cpp +++ b/src/mesh/Router.cpp @@ -188,7 +188,7 @@ ErrorCode Router::sendLocal(meshtastic_MeshPacket *p, RxSource src) // don't override if a channel was requested and no need to set it when PKI is enforced if (!p->channel && !p->pki_encrypted && !isBroadcast(p->to)) { - meshtastic_NodeInfoLite *node = nodeDB->getMeshNode(p->to); + meshtastic_NodeInfoLite const *node = nodeDB->getMeshNode(p->to); if (node) { p->channel = node->channel; LOG_DEBUG("localSend to channel %d", p->channel); @@ -688,7 +688,7 @@ void Router::perhapsHandleReceived(meshtastic_MeshPacket *p) return; } - meshtastic_NodeInfoLite *node = nodeDB->getMeshNode(p->from); + meshtastic_NodeInfoLite const *node = nodeDB->getMeshNode(p->from); if (node != NULL && node->is_ignored) { LOG_DEBUG("Ignore msg, 0x%x is ignored", p->from); packetPool.release(p); diff --git a/src/mesh/generated/meshtastic/mesh.pb.h b/src/mesh/generated/meshtastic/mesh.pb.h index daee04f90..defaaad28 100644 --- a/src/mesh/generated/meshtastic/mesh.pb.h +++ b/src/mesh/generated/meshtastic/mesh.pb.h @@ -326,7 +326,11 @@ typedef enum _meshtastic_ExcludedModules { /* Detection Sensor module */ meshtastic_ExcludedModules_DETECTIONSENSOR_CONFIG = 2048, /* Paxcounter module */ - meshtastic_ExcludedModules_PAXCOUNTER_CONFIG = 4096 + meshtastic_ExcludedModules_PAXCOUNTER_CONFIG = 4096, + /* Bluetooth config (not technically a module, but used to indicate bluetooth capabilities) */ + meshtastic_ExcludedModules_BLUETOOTH_CONFIG = 8192, + /* Network config (not technically a module, but used to indicate network capabilities) */ + meshtastic_ExcludedModules_NETWORK_CONFIG = 16384 } meshtastic_ExcludedModules; /* How the location was acquired: manual, onboard GPS, external (EUD) GPS */ @@ -1122,8 +1126,8 @@ extern "C" { #define _meshtastic_CriticalErrorCode_ARRAYSIZE ((meshtastic_CriticalErrorCode)(meshtastic_CriticalErrorCode_FLASH_CORRUPTION_UNRECOVERABLE+1)) #define _meshtastic_ExcludedModules_MIN meshtastic_ExcludedModules_EXCLUDED_NONE -#define _meshtastic_ExcludedModules_MAX meshtastic_ExcludedModules_PAXCOUNTER_CONFIG -#define _meshtastic_ExcludedModules_ARRAYSIZE ((meshtastic_ExcludedModules)(meshtastic_ExcludedModules_PAXCOUNTER_CONFIG+1)) +#define _meshtastic_ExcludedModules_MAX meshtastic_ExcludedModules_NETWORK_CONFIG +#define _meshtastic_ExcludedModules_ARRAYSIZE ((meshtastic_ExcludedModules)(meshtastic_ExcludedModules_NETWORK_CONFIG+1)) #define _meshtastic_Position_LocSource_MIN meshtastic_Position_LocSource_LOC_UNSET #define _meshtastic_Position_LocSource_MAX meshtastic_Position_LocSource_LOC_EXTERNAL diff --git a/src/mesh/wifi/WiFiAPClient.cpp b/src/mesh/wifi/WiFiAPClient.cpp index 4d0b74f7c..e050c2057 100644 --- a/src/mesh/wifi/WiFiAPClient.cpp +++ b/src/mesh/wifi/WiFiAPClient.cpp @@ -163,7 +163,7 @@ static int32_t reconnectWiFi() delay(5000); if (!WiFi.isConnected()) { -#ifdef CONFIG_IDF_TARGET_ESP32C3 +#ifdef ARCH_ESP32 WiFi.mode(WIFI_MODE_NULL); WiFi.useStaticBuffers(true); WiFi.mode(WIFI_STA); diff --git a/src/modules/SerialModule.cpp b/src/modules/SerialModule.cpp index 34ece2312..f3f23b080 100644 --- a/src/modules/SerialModule.cpp +++ b/src/modules/SerialModule.cpp @@ -60,7 +60,7 @@ SerialModule *serialModule; SerialModuleRadio *serialModuleRadio; -#if defined(TTGO_T_ECHO) || defined(CANARYONE) || defined(MESHLINK) +#if defined(TTGO_T_ECHO) || defined(CANARYONE) || defined(MESHLINK) || defined(ELECROW_ThinkNode_M1) SerialModule::SerialModule() : StreamAPI(&Serial), concurrency::OSThread("Serial") {} static Print *serialPrint = &Serial; #elif defined(CONFIG_IDF_TARGET_ESP32C6) @@ -158,7 +158,7 @@ int32_t SerialModule::runOnce() Serial.begin(baud); Serial.setTimeout(moduleConfig.serial.timeout > 0 ? moduleConfig.serial.timeout : TIMEOUT); } -#elif !defined(TTGO_T_ECHO) && !defined(CANARYONE) && !defined(MESHLINK) +#elif !defined(TTGO_T_ECHO) && !defined(CANARYONE) && !defined(MESHLINK) && !defined(ELECROW_ThinkNode_M1) if (moduleConfig.serial.rxd && moduleConfig.serial.txd) { #ifdef ARCH_RP2040 Serial2.setFIFOSize(RX_BUFFER); @@ -214,7 +214,7 @@ int32_t SerialModule::runOnce() } } -#if !defined(TTGO_T_ECHO) && !defined(CANARYONE) && !defined(MESHLINK) +#if !defined(TTGO_T_ECHO) && !defined(CANARYONE) && !defined(MESHLINK) && !defined(ELECROW_ThinkNode_M1) else if ((moduleConfig.serial.mode == meshtastic_ModuleConfig_SerialConfig_Serial_Mode_WS85)) { processWXSerial(); @@ -416,7 +416,8 @@ uint32_t SerialModule::getBaudRate() */ void SerialModule::processWXSerial() { -#if !defined(TTGO_T_ECHO) && !defined(CANARYONE) && !defined(CONFIG_IDF_TARGET_ESP32C6) && !defined(MESHLINK) +#if !defined(TTGO_T_ECHO) && !defined(CANARYONE) && !defined(CONFIG_IDF_TARGET_ESP32C6) && !defined(MESHLINK) && \ + !defined(ELECROW_ThinkNode_M1) static unsigned int lastAveraged = 0; static unsigned int averageIntervalMillis = 300000; // 5 minutes hard coded. static double dir_sum_sin = 0; diff --git a/src/platform/esp32/architecture.h b/src/platform/esp32/architecture.h index 631df0fe4..0af6d4d04 100644 --- a/src/platform/esp32/architecture.h +++ b/src/platform/esp32/architecture.h @@ -144,6 +144,8 @@ #define HW_VENDOR meshtastic_HardwareModel_HELTEC_HT62 #elif defined(EBYTE_ESP32_S3) #define HW_VENDOR meshtastic_HardwareModel_EBYTE_ESP32_S3 +#elif defined(ELECROW_ThinkNode_M2) +#define HW_VENDOR meshtastic_HardwareModel_THINKNODE_M2 #elif defined(ESP32_S3_PICO) #define HW_VENDOR meshtastic_HardwareModel_ESP32_S3_PICO #elif defined(SENSELORA_S3) diff --git a/src/platform/esp32/main-esp32.cpp b/src/platform/esp32/main-esp32.cpp index d0fe31f21..ab1e5c922 100644 --- a/src/platform/esp32/main-esp32.cpp +++ b/src/platform/esp32/main-esp32.cpp @@ -109,6 +109,11 @@ void esp32Setup() randomSeed(seed); */ +#ifdef POWER_FULL + pinMode(POWER_FULL, INPUT); + pinMode(7, INPUT); +#endif + LOG_DEBUG("Total heap: %d", ESP.getHeapSize()); LOG_DEBUG("Free heap: %d", ESP.getFreeHeap()); LOG_DEBUG("Total PSRAM: %d", ESP.getPsramSize()); diff --git a/src/platform/nrf52/architecture.h b/src/platform/nrf52/architecture.h index bf7fce29a..4e8823063 100644 --- a/src/platform/nrf52/architecture.h +++ b/src/platform/nrf52/architecture.h @@ -53,6 +53,8 @@ #define HW_VENDOR meshtastic_HardwareModel_RAK4631 #elif defined(TTGO_T_ECHO) #define HW_VENDOR meshtastic_HardwareModel_T_ECHO +#elif defined(ELECROW_ThinkNode_M1) +#define HW_VENDOR meshtastic_HardwareModel_THINKNODE_M1 #elif defined(NANO_G2_ULTRA) #define HW_VENDOR meshtastic_HardwareModel_NANO_G2_ULTRA #elif defined(CANARYONE) @@ -75,6 +77,8 @@ #define HW_VENDOR meshtastic_HardwareModel_PRIVATE_HW #elif defined(HELTEC_T114) #define HW_VENDOR meshtastic_HardwareModel_HELTEC_MESH_NODE_T114 +#elif defined(MESHLINK) +#define HW_VENDOR meshtastic_HardwareModel_MESHLINK #elif defined(SEEED_XIAO_NRF52840_KIT) #define HW_VENDOR meshtastic_HardwareModel_XIAO_NRF52_KIT #else @@ -129,4 +133,4 @@ #if !defined(PIN_SERIAL_RX) && !defined(NRF52840_XXAA) // No serial ports on this board - ONLY use segger in memory console #define USE_SEGGER -#endif \ No newline at end of file +#endif diff --git a/src/platform/nrf52/main-nrf52.cpp b/src/platform/nrf52/main-nrf52.cpp index 8483d21c6..53971e95a 100644 --- a/src/platform/nrf52/main-nrf52.cpp +++ b/src/platform/nrf52/main-nrf52.cpp @@ -235,6 +235,14 @@ void nrf52InitSemiHosting() void nrf52Setup() { +#ifdef USB_CHECK + pinMode(USB_CHECK, INPUT); +#endif + +#ifdef ADC_V + pinMode(ADC_V, INPUT); +#endif + uint32_t why = NRF_POWER->RESETREAS; // per // https://infocenter.nordicsemi.com/index.jsp?topic=%2Fcom.nordic.infocenter.nrf52832.ps.v1.1%2Fpower.html @@ -275,9 +283,11 @@ void cpuDeepSleep(uint32_t msecToWake) Wire.end(); #endif SPI.end(); +#if SPI_INTERFACES_COUNT > 1 + SPI1.end(); +#endif // This may cause crashes as debug messages continue to flow. Serial.end(); - #ifdef PIN_SERIAL_RX1 Serial1.end(); #endif @@ -315,6 +325,31 @@ void cpuDeepSleep(uint32_t msecToWake) detachInterrupt(PIN_GPS_PPS); detachInterrupt(PIN_BUTTON1); #endif + +#ifdef ELECROW_ThinkNode_M1 + for (int pin = 0; pin < 48; pin++) { + if (pin == 17 || pin == 19 || pin == 20 || pin == 22 || pin == 23 || pin == 24 || pin == 25 || pin == 9 || pin == 10 || + pin == PIN_BUTTON1 || pin == PIN_BUTTON2) { + continue; + } + pinMode(pin, OUTPUT); + } + for (int pin = 0; pin < 48; pin++) { + if (pin == 17 || pin == 19 || pin == 20 || pin == 22 || pin == 23 || pin == 24 || pin == 25 || pin == 9 || pin == 10 || + pin == PIN_BUTTON1 || pin == PIN_BUTTON2) { + continue; + } + digitalWrite(pin, LOW); + } + for (int pin = 0; pin < 48; pin++) { + if (pin == 17 || pin == 19 || pin == 20 || pin == 22 || pin == 23 || pin == 24 || pin == 25 || pin == 9 || pin == 10 || + pin == PIN_BUTTON1 || pin == PIN_BUTTON2) { + continue; + } + NRF_GPIO->DIRCLR = (1 << pin); + } +#endif + // Sleepy trackers or sensors can low power "sleep" // Don't enter this if we're sleeping portMAX_DELAY, since that's a shutdown event if (msecToWake != portMAX_DELAY && @@ -333,6 +368,17 @@ void cpuDeepSleep(uint32_t msecToWake) // FIXME, use system off mode with ram retention for key state? // FIXME, use non-init RAM per // https://devzone.nordicsemi.com/f/nordic-q-a/48919/ram-retention-settings-with-softdevice-enabled + +#ifdef ELECROW_ThinkNode_M1 + nrf_gpio_cfg_input(PIN_BUTTON1, NRF_GPIO_PIN_PULLUP); // Configure the pin to be woken up as an input + nrf_gpio_pin_sense_t sense = NRF_GPIO_PIN_SENSE_LOW; + nrf_gpio_cfg_sense_set(PIN_BUTTON1, sense); + + nrf_gpio_cfg_input(PIN_BUTTON2, NRF_GPIO_PIN_PULLUP); + nrf_gpio_pin_sense_t sense1 = NRF_GPIO_PIN_SENSE_LOW; + nrf_gpio_cfg_sense_set(PIN_BUTTON2, sense1); +#endif + auto ok = sd_power_system_off(); if (ok != NRF_SUCCESS) { LOG_ERROR("FIXME: Ignoring soft device (EasyDMA pending?) and forcing system-off!"); diff --git a/src/platform/portduino/PortduinoGlue.cpp b/src/platform/portduino/PortduinoGlue.cpp index 9da65c92c..7b13971b4 100644 --- a/src/platform/portduino/PortduinoGlue.cpp +++ b/src/platform/portduino/PortduinoGlue.cpp @@ -210,7 +210,10 @@ void portduinoSetup() } char serial[9] = {0}; ch341Hal->getSerialString(serial, 8); - std::cout << "Serial " << serial << std::endl; + std::cout << "CH341 Serial " << serial << std::endl; + char product_string[96] = {0}; + ch341Hal->getProductString(product_string, 95); + std::cout << "CH341 Product " << product_string << std::endl; if (strlen(serial) == 8 && settingsStrings[mac_address].length() < 12) { uint8_t hash[32] = {0}; memcpy(hash, serial, 8); diff --git a/src/platform/portduino/USBHal.h b/src/platform/portduino/USBHal.h index 0d6b361f4..ce2a5cfd3 100644 --- a/src/platform/portduino/USBHal.h +++ b/src/platform/portduino/USBHal.h @@ -61,6 +61,12 @@ class Ch341Hal : public RadioLibHal strncpy(_serial, pinedio.serial_number, len); } + void getProductString(char *_product_string, size_t len) + { + len = len > 95 ? 95 : len; + strncpy(_product_string, pinedio.product_string, len); + } + void init() override {} void term() override {} diff --git a/src/platform/stm32wl/STM32_LittleFS.h b/src/platform/stm32wl/STM32_LittleFS.h index 2ab531ee5..9460ffa81 100644 --- a/src/platform/stm32wl/STM32_LittleFS.h +++ b/src/platform/stm32wl/STM32_LittleFS.h @@ -37,7 +37,7 @@ class STM32_LittleFS { public: STM32_LittleFS(void); - STM32_LittleFS(struct lfs_config *cfg); + explicit STM32_LittleFS(struct lfs_config *cfg); virtual ~STM32_LittleFS(); bool begin(struct lfs_config *cfg = NULL); diff --git a/src/platform/stm32wl/STM32_LittleFS_File.cpp b/src/platform/stm32wl/STM32_LittleFS_File.cpp index 5e2d4c86c..349187a02 100644 --- a/src/platform/stm32wl/STM32_LittleFS_File.cpp +++ b/src/platform/stm32wl/STM32_LittleFS_File.cpp @@ -217,9 +217,9 @@ int File::available(void) _fs->_lockFS(); if (!this->_is_dir) { - uint32_t size = lfs_file_size(_fs->_getFS(), _file); + uint32_t file_size = lfs_file_size(_fs->_getFS(), _file); uint32_t pos = lfs_file_tell(_fs->_getFS(), _file); - ret = size - pos; + ret = file_size - pos; } _fs->_unlockFS(); @@ -279,10 +279,9 @@ bool File::truncate(uint32_t pos) bool File::truncate(void) { int32_t ret = LFS_ERR_ISDIR; - uint32_t pos; _fs->_lockFS(); if (!this->_is_dir) { - pos = lfs_file_tell(_fs->_getFS(), _file); + uint32_t pos = lfs_file_tell(_fs->_getFS(), _file); ret = lfs_file_truncate(_fs->_getFS(), _file, pos); } _fs->_unlockFS(); diff --git a/src/platform/stm32wl/STM32_LittleFS_File.h b/src/platform/stm32wl/STM32_LittleFS_File.h index 0a021dc54..2b48b02e0 100644 --- a/src/platform/stm32wl/STM32_LittleFS_File.h +++ b/src/platform/stm32wl/STM32_LittleFS_File.h @@ -42,7 +42,7 @@ enum { class File : public Stream { public: - File(STM32_LittleFS &fs); + explicit File(STM32_LittleFS &fs); File(char const *filename, uint8_t mode, STM32_LittleFS &fs); public: diff --git a/src/platform/stm32wl/littlefs/lfs.c b/src/platform/stm32wl/littlefs/lfs.c index 522614486..5dc4c7669 100644 --- a/src/platform/stm32wl/littlefs/lfs.c +++ b/src/platform/stm32wl/littlefs/lfs.c @@ -863,7 +863,7 @@ static int lfs_dir_find(lfs_t *lfs, lfs_dir_t *dir, lfs_entry_t *entry, const ch // check that entry has not been moved if (entry->d.type & 0x80) { int moved = lfs_moved(lfs, &entry->d.u); - if (moved < 0 || moved) { + if (moved) { return (moved < 0) ? moved : LFS_ERR_NOENT; } @@ -1057,12 +1057,6 @@ int lfs_dir_seek(lfs_t *lfs, lfs_dir_t *dir, lfs_off_t off) return 0; } -lfs_soff_t lfs_dir_tell(lfs_t *lfs, lfs_dir_t *dir) -{ - (void)lfs; - return dir->pos; -} - int lfs_dir_rewind(lfs_t *lfs, lfs_dir_t *dir) { // reload the head dir @@ -1755,7 +1749,7 @@ int lfs_file_truncate(lfs_t *lfs, lfs_file_t *file, lfs_off_t size) return 0; } -lfs_soff_t lfs_file_tell(lfs_t *lfs, lfs_file_t *file) +lfs_soff_t lfs_file_tell(lfs_t *lfs, lfs_file_t const *file) { (void)lfs; return file->pos; diff --git a/src/platform/stm32wl/littlefs/lfs.h b/src/platform/stm32wl/littlefs/lfs.h index f243c404b..c6ed1d622 100644 --- a/src/platform/stm32wl/littlefs/lfs.h +++ b/src/platform/stm32wl/littlefs/lfs.h @@ -389,7 +389,7 @@ int lfs_file_truncate(lfs_t *lfs, lfs_file_t *file, lfs_off_t size); // // Equivalent to lfs_file_seek(lfs, file, 0, LFS_SEEK_CUR) // Returns the position of the file, or a negative error code on failure. -lfs_soff_t lfs_file_tell(lfs_t *lfs, lfs_file_t *file); +lfs_soff_t lfs_file_tell(lfs_t *lfs, const lfs_file_t *file); // Change the position of the file to the beginning of the file // @@ -436,14 +436,6 @@ int lfs_dir_read(lfs_t *lfs, lfs_dir_t *dir, struct lfs_info *info); // Returns a negative error code on failure. int lfs_dir_seek(lfs_t *lfs, lfs_dir_t *dir, lfs_off_t off); -// Return the position of the directory -// -// The returned offset is only meant to be consumed by seek and may not make -// sense, but does indicate the current position in the directory iteration. -// -// Returns the position of the directory, or a negative error code on failure. -lfs_soff_t lfs_dir_tell(lfs_t *lfs, lfs_dir_t *dir); - // Change the position of the directory to the beginning of the directory // // Returns a negative error code on failure. diff --git a/src/power.h b/src/power.h index e9c0deb7c..97944fef7 100644 --- a/src/power.h +++ b/src/power.h @@ -84,6 +84,11 @@ class Power : private concurrency::OSThread void setStatusHandler(meshtastic::PowerStatus *handler) { statusHandler = handler; } const uint16_t OCV[11] = {OCV_ARRAY}; +#if defined(ELECROW_ThinkNode_M1) || defined(POWER_CFG) + uint8_t low_voltage_counter_led3; + int power_num = 0; +#endif + protected: meshtastic::PowerStatus *statusHandler; diff --git a/src/sleep.cpp b/src/sleep.cpp index 202b8c354..02fa8d871 100644 --- a/src/sleep.cpp +++ b/src/sleep.cpp @@ -228,6 +228,7 @@ void doDeepSleep(uint32_t msecToWake, bool skipPreflight = false, bool skipSaveN } #ifdef PIN_POWER_EN + digitalWrite(PIN_POWER_EN, LOW); pinMode(PIN_POWER_EN, INPUT); // power off peripherals // pinMode(PIN_POWER_EN1, INPUT_PULLDOWN); #endif diff --git a/variants/CDEBYTE_E77-MBL/platformio.ini b/variants/CDEBYTE_E77-MBL/platformio.ini index 3252a56ea..8a8002086 100644 --- a/variants/CDEBYTE_E77-MBL/platformio.ini +++ b/variants/CDEBYTE_E77-MBL/platformio.ini @@ -1,7 +1,5 @@ [env:CDEBYTE_E77-MBL] extends = stm32_base -; `ebyte_e77_dev` was added in this commit. Remove when a new release is used in the base. -platform = https://github.com/platformio/platform-ststm32.git#3208828db447f4373cd303b7f7393c8fc0dae623 board = ebyte_e77_dev board_upload.maximum_size = 233472 ; reserve the last 28KB for filesystem board_level = extra diff --git a/variants/ELECROW-ThinkNode-M1/platformio.ini b/variants/ELECROW-ThinkNode-M1/platformio.ini new file mode 100644 index 000000000..f37f6d310 --- /dev/null +++ b/variants/ELECROW-ThinkNode-M1/platformio.ini @@ -0,0 +1,29 @@ +; First prototype eink/nrf52840/sx1262 device +[env:thinknode_m1] +extends = nrf52840_base +board = ThinkNode-M1 +board_check = true +debug_tool = jlink + +# add -DCFG_SYSVIEW if you want to use the Segger systemview tool for OS profiling. +build_flags = ${nrf52840_base.build_flags} -Ivariants/ELECROW-ThinkNode-M1 + -DELECROW_ThinkNode_M1 + -DGPS_POWER_TOGGLE + -L "${platformio.libdeps_dir}/${this.__env__}/bsec2/src/cortex-m4/fpv4-sp-d16-hard" + -DEINK_DISPLAY_MODEL=GxEPD2_154_D67 + -DEINK_WIDTH=200 + -DEINK_HEIGHT=200 + -DUSE_EINK_DYNAMICDISPLAY ; Enable Dynamic EInk + -DEINK_LIMIT_FASTREFRESH=10 ; How many consecutive fast-refreshes are permitted //20 + -DEINK_LIMIT_RATE_BACKGROUND_SEC=10 ; Minimum interval between BACKGROUND updates //30 + -DEINK_LIMIT_RATE_RESPONSIVE_SEC=1 ; Minimum interval between RESPONSIVE updates +; -DEINK_LIMIT_GHOSTING_PX=2000 ; (Optional) How much image ghosting is tolerated + -DEINK_BACKGROUND_USES_FAST ; (Optional) Use FAST refresh for both BACKGROUND and RESPONSIVE, until a limit is reached. + +build_src_filter = ${nrf52_base.build_src_filter} +<../variants/ELECROW-ThinkNode-M1> +lib_deps = + ${nrf52840_base.lib_deps} + https://github.com/meshtastic/GxEPD2/archive/33db3fa8ee6fc47d160bdb44f8f127c9a9203a10.zip + lewisxhe/PCF8563_Library@^1.0.1 + khoih-prog/nRF52_PWM@^1.0.1 +;upload_protocol = fs \ No newline at end of file diff --git a/variants/ELECROW-ThinkNode-M1/variant.cpp b/variants/ELECROW-ThinkNode-M1/variant.cpp new file mode 100644 index 000000000..cae079b74 --- /dev/null +++ b/variants/ELECROW-ThinkNode-M1/variant.cpp @@ -0,0 +1,44 @@ +/* + Copyright (c) 2014-2015 Arduino LLC. All right reserved. + Copyright (c) 2016 Sandeep Mistry All right reserved. + Copyright (c) 2018, Adafruit Industries (adafruit.com) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#include "variant.h" +#include "nrf.h" +#include "wiring_constants.h" +#include "wiring_digital.h" + +const uint32_t g_ADigitalPinMap[] = { + // P0 - pins 0 and 1 are hardwired for xtal and should never be enabled + 0xff, 0xff, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, + + // P1 + 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47}; + +void initVariant() +{ + // LED1 & LED2 + pinMode(PIN_LED1, OUTPUT); + ledOff(PIN_LED1); + + pinMode(PIN_LED2, OUTPUT); + ledOff(PIN_LED2); + + pinMode(PIN_LED3, OUTPUT); + ledOff(PIN_LED3); +} diff --git a/variants/ELECROW-ThinkNode-M1/variant.h b/variants/ELECROW-ThinkNode-M1/variant.h new file mode 100644 index 000000000..3bfa360f6 --- /dev/null +++ b/variants/ELECROW-ThinkNode-M1/variant.h @@ -0,0 +1,205 @@ +/* + Copyright (c) 2014-2015 Arduino LLC. All right reserved. + Copyright (c) 2016 Sandeep Mistry All right reserved. + Copyright (c) 2018, Adafruit Industries (adafruit.com) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the GNU Lesser General Public License for more details. + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#ifndef _VARIANT_ELECROW_EINK_V1_0_ +#define _VARIANT_ELECROW_EINK_V1_0_ + +/** Master clock frequency */ +#define VARIANT_MCK (64000000ul) + +#define USE_LFXO // Board uses 32khz crystal for LF + +/*---------------------------------------------------------------------------- + * Headers + *----------------------------------------------------------------------------*/ + +#include "WVariant.h" + +#ifdef __cplusplus +extern "C" { +#endif // __cplusplus + +// Number of pins defined in PinDescription array +// 在PinDescription数组中定义的引脚数 +#define PINS_COUNT (48) +#define NUM_DIGITAL_PINS (48) +#define NUM_ANALOG_INPUTS (1) +#define NUM_ANALOG_OUTPUTS (0) + +#define PIN_LED1 -1 +#define PIN_LED2 -1 +#define PIN_LED3 -1 + +// LED +#define POWER_LED (32 + 6) // red +#define LED_POWER (32 + 4) +#define USER_LED (0 + 13) // green +// USB_CHECK +#define USB_CHECK (32 + 3) +#define ADC_V (0 + 8) + +#define LED_RED PIN_LED3 +#define LED_BLUE PIN_LED1 +#define LED_GREEN PIN_LED2 +#define LED_BUILTIN LED_BLUE +#define LED_CONN PIN_GREEN +#define LED_STATE_ON 0 // State when LED is lit // LED灯亮时的状态 +#define M1_buzzer (0 + 6) +/* + * Buttons + */ +#define PIN_BUTTON2 (32 + 10) +#define PIN_BUTTON1 (32 + 7) + +// #define PIN_BUTTON1 (0 + 11) +// #define PIN_BUTTON1 (32 + 7) + +// #define BUTTON_CLICK_MS 400 +// #define BUTTON_TOUCH_MS 200 + +/* + * Analog pins + */ +#define PIN_A0 (4) // Battery ADC + +#define BATTERY_PIN PIN_A0 + +static const uint8_t A0 = PIN_A0; + +#define ADC_RESOLUTION 14 + +#define PIN_NFC1 (9) +#define PIN_NFC2 (10) + +/*Wire Interfaces*/ +#define WIRE_INTERFACES_COUNT 1 + +#define PIN_WIRE_SDA (26) +#define PIN_WIRE_SCL (27) + +/* touch sensor, active high */ + +#define TP_SER_IO (0 + 11) + +#define PIN_RTC_INT (0 + 16) // Interrupt from the PCF8563 RTC + +/* +External serial flash WP25R1635FZUIL0 +*/ + +// QSPI Pins +#define PIN_QSPI_SCK (32 + 14) +#define PIN_QSPI_CS (32 + 15) +#define PIN_QSPI_IO0 (32 + 12) // MOSI if using two bit interface +#define PIN_QSPI_IO1 (32 + 13) // MISO if using two bit interface +#define PIN_QSPI_IO2 (0 + 7) // WP if using two bit interface (i.e. not used) +#define PIN_QSPI_IO3 (0 + 5) // HOLD if using two bit interface (i.e. not used) + +// On-board QSPI Flash +#define EXTERNAL_FLASH_DEVICES MX25R1635F +#define EXTERNAL_FLASH_USE_QSPI + +/* + * Lora radio + */ +#define SX126X_POWER_EN (0 + 21) +#define USE_SX1262 +#define SX126X_CS (0 + 24) // FIXME - we really should define LORA_CS instead +#define SX126X_DIO1 (0 + 20) +// Note DIO2 is attached internally to the module to an analog switch for TX/RX switching +// #define SX1262_DIO3 (0 + 21) // This is used as an *output* from the sx1262 and connected internally to power the tcxo, do not +// drive from the main +#define SX126X_BUSY (0 + 17) +#define SX126X_RESET (0 + 25) +#define SX126X_DIO2_AS_RF_SWITCH +#define SX126X_DIO3_TCXO_VOLTAGE 3.3 + +#define PIN_EINK_EN (32 + 11) // Note: this is really just backlight power +#define PIN_EINK_CS (0 + 30) +#define PIN_EINK_BUSY (0 + 3) +#define PIN_EINK_DC (0 + 28) +#define PIN_EINK_RES (0 + 2) +#define PIN_EINK_SCLK (0 + 31) +#define PIN_EINK_MOSI (0 + 29) // also called SDI + +// Controls power for all peripherals (eink + GPS + LoRa + Sensor) +#define PIN_POWER_EN (0 + 12) + +#define USE_EINK + +#define PIN_SPI1_MISO (32 + 7) +#define PIN_SPI1_MOSI PIN_EINK_MOSI +#define PIN_SPI1_SCK PIN_EINK_SCLK + +/* + * GPS pins + */ +// #define HAS_GPS 1 +#define GPS_L76K +#define GPS_BAUDRATE 9600 +#define PIN_GPS_REINIT (32 + 5) // An output to reset L76K GPS. As per datasheet, low for > 100ms will reset the L76K +#define PIN_GPS_STANDBY (32 + 2) // An output to wake GPS, low means allow sleep, high means force wake +// Seems to be missing on this new board +// #define PIN_GPS_PPS (32 + 4) // Pulse per second input from the GPS +#define GPS_TX_PIN (32 + 9) // This is for bits going TOWARDS the CPU +#define GPS_RX_PIN (32 + 8) // This is for bits going TOWARDS the GPS + +#define GPS_THREAD_INTERVAL 50 + +#define PIN_GPS_PPS (32 + 1) // GPS开关判断 + +#define PIN_SERIAL1_RX GPS_TX_PIN +#define PIN_SERIAL1_TX GPS_RX_PIN + +// PCF8563 RTC Module +#define PCF8563_RTC 0x51 + +/* + * SPI Interfaces + */ +#define SPI_INTERFACES_COUNT 2 + +// For LORA, spi 0 +#define PIN_SPI_MISO (0 + 23) +#define PIN_SPI_MOSI (0 + 22) +#define PIN_SPI_SCK (0 + 19) + +#define PIN_PWR_EN (0 + 6) + +// To debug via the segger JLINK console rather than the CDC-ACM serial device +// #define USE_SEGGER + +// Battery +// The battery sense is hooked to pin A0 (4) +// it is defined in the anlaolgue pin section of this file +// and has 12 bit resolution +#define BATTERY_SENSE_RESOLUTION_BITS 12 +#define BATTERY_SENSE_RESOLUTION 4096.0 +#undef AREF_VOLTAGE +#define AREF_VOLTAGE 3.0 +#define VBAT_AR_INTERNAL AR_INTERNAL_3_0 +#define ADC_MULTIPLIER (2.02F) + +// #define HAS_RTC 0 +// #define HAS_SCREEN 0 + +#ifdef __cplusplus +} +#endif + +#endif \ No newline at end of file diff --git a/variants/ELECROW-ThinkNode-M2/pins_arduino.h b/variants/ELECROW-ThinkNode-M2/pins_arduino.h new file mode 100644 index 000000000..46415d30f --- /dev/null +++ b/variants/ELECROW-ThinkNode-M2/pins_arduino.h @@ -0,0 +1,28 @@ +// Need this file for ESP32-S3 +// No need to modify this file, changes to pins imported from variant.h +// Most is similar to https://github.com/espressif/arduino-esp32/blob/master/variants/esp32s3/pins_arduino.h + +#ifndef Pins_Arduino_h +#define Pins_Arduino_h + +#include +#include + +#define USB_VID 0x303a +#define USB_PID 0x1001 + +// Serial +static const uint8_t TX = UART_TX; +static const uint8_t RX = UART_RX; + +// Default SPI will be mapped to Radio +static const uint8_t SS = LORA_CS; +static const uint8_t SCK = LORA_SCK; +static const uint8_t MOSI = LORA_MOSI; +static const uint8_t MISO = LORA_MISO; + +// The default Wire will be mapped to PMU and RTC +static const uint8_t SCL = I2C_SCL; +static const uint8_t SDA = I2C_SDA; + +#endif /* Pins_Arduino_h */ diff --git a/variants/ELECROW-ThinkNode-M2/platformio.ini b/variants/ELECROW-ThinkNode-M2/platformio.ini new file mode 100644 index 000000000..c08c94a71 --- /dev/null +++ b/variants/ELECROW-ThinkNode-M2/platformio.ini @@ -0,0 +1,7 @@ +[env:thinknode_m2] +extends = esp32s3_base +board = ESP32-S3-WROOM-1-N4 +build_flags = + ${esp32s3_base.build_flags} + -D ELECROW_ThinkNode_M2 + -I variants/ELECROW-ThinkNode-M2 diff --git a/variants/ELECROW-ThinkNode-M2/variant.h b/variants/ELECROW-ThinkNode-M2/variant.h new file mode 100644 index 000000000..801d5606f --- /dev/null +++ b/variants/ELECROW-ThinkNode-M2/variant.h @@ -0,0 +1,64 @@ +// Status +#define LED_PIN_POWER 1 +#define BIAS_T_ENABLE LED_PIN_POWER +#define BIAS_T_VALUE HIGH + +#define PIN_BUTTON1 47 // 功能键 +#define PIN_BUTTON2 4 // 电源键 + +#define POWER_CFG +#define POWER_CHRG 6 +#define POWER_FULL 42 + +#define PIN_BUZZER 5 + +#define I2C_SCL 15 +#define I2C_SDA 16 + +#define UART_TX 43 +#define UART_RX 44 + +#define VEXT_ENABLE 46 // for OLED +#define VEXT_ON_VALUE HIGH + +#define SX126X_CS 10 +#define LORA_SCK 12 +#define LORA_MOSI 11 +#define LORA_MISO 13 +#define SX126X_RESET 21 +#define SX126X_BUSY 14 +#define SX126X_DIO1 3 +#define SX126X_DIO2_AS_RF_SWITCH +// #define SX126X_DIO3 9 +#define SX126X_DIO3_TCXO_VOLTAGE 3.3 + +#define SX126X_MAX_POWER 22 // SX126xInterface.cpp defaults to 22 if not defined, but here we define it for good practice +#define USE_SX1262 +#define LORA_CS SX126X_CS // FIXME: for some reason both are used in /src +#define LORA_DIO1 SX126X_DIO1 +#define SX126X_POWER_EN 48 + +// Battery +// #define BATTERY_PIN 2 +#define BATTERY_PIN 17 +// #define ADC_CHANNEL ADC1_GPIO2_CHANNEL +#define ADC_CHANNEL ADC2_GPIO17_CHANNEL +#define BATTERY_SENSE_RESOLUTION_BITS 12 +#define BATTERY_SENSE_RESOLUTION 4096.0 +#undef AREF_VOLTAGE +#define AREF_VOLTAGE 3.0 +#define VBAT_AR_INTERNAL AR_INTERNAL_3_0 +#define ADC_MULTIPLIER (1.548F) +#define BAT_MEASURE_ADC_UNIT 2 + +#define HAS_SCREEN 1 +#define USE_SH1106 1 + +// PCF8563 RTC Module +// #define PCF8563_RTC 0x51 +// #define PIN_RTC_INT 48 // Interrupt from the PCF8563 RTC +#define HAS_RTC 0 +#define HAS_GPS 0 + +#define BUTTON_PIN PIN_BUTTON1 +#define BUTTON_PIN_ALT PIN_BUTTON2 diff --git a/variants/MakePython_nRF52840_eink/platformio.ini b/variants/MakePython_nRF52840_eink/platformio.ini index b7ce97dcb..9e2d5bbf7 100644 --- a/variants/MakePython_nRF52840_eink/platformio.ini +++ b/variants/MakePython_nRF52840_eink/platformio.ini @@ -11,7 +11,7 @@ build_flags = ${nrf52840_base.build_flags} -Ivariants/MakePython_nRF52840_eink - build_src_filter = ${nrf52_base.build_src_filter} +<../variants/MakePython_nRF52840_eink> lib_deps = ${nrf52840_base.lib_deps} - https://github.com/meshtastic/ESP32_Codec2.git#633326c78ac251c059ab3a8c430fcdf25b41672f + https://github.com/meshtastic/ESP32_Codec2/archive/633326c78ac251c059ab3a8c430fcdf25b41672f.zip zinggjm/GxEPD2@^1.6.2 debug_tool = jlink ;upload_port = /dev/ttyACM4 \ No newline at end of file diff --git a/variants/MakePython_nRF52840_oled/platformio.ini b/variants/MakePython_nRF52840_oled/platformio.ini index 0146385e0..25dd36c08 100644 --- a/variants/MakePython_nRF52840_oled/platformio.ini +++ b/variants/MakePython_nRF52840_oled/platformio.ini @@ -7,5 +7,5 @@ build_flags = ${nrf52840_base.build_flags} -Ivariants/MakePython_nRF52840_oled - build_src_filter = ${nrf52_base.build_src_filter} +<../variants/MakePython_nRF52840_oled> lib_deps = ${nrf52840_base.lib_deps} - https://github.com/meshtastic/ESP32_Codec2.git#633326c78ac251c059ab3a8c430fcdf25b41672f + https://github.com/meshtastic/ESP32_Codec2/archive/633326c78ac251c059ab3a8c430fcdf25b41672f.zip debug_tool = jlink diff --git a/variants/crowpanel-esp32s3-5-epaper/platformio.ini b/variants/crowpanel-esp32s3-5-epaper/platformio.ini index c9786690b..f1257a979 100644 --- a/variants/crowpanel-esp32s3-5-epaper/platformio.ini +++ b/variants/crowpanel-esp32s3-5-epaper/platformio.ini @@ -24,7 +24,7 @@ build_flags = ;-DEINK_LIMIT_RATE_RESPONSIVE_SEC=1 lib_deps = ${esp32s3_base.lib_deps} - https://github.com/meshtastic/GxEPD2 + https://github.com/meshtastic/GxEPD2/archive/33db3fa8ee6fc47d160bdb44f8f127c9a9203a10.zip [env:crowpanel-esp32s3-4-epaper] extends = esp32s3_base @@ -52,7 +52,7 @@ build_flags = ;-DEINK_LIMIT_RATE_RESPONSIVE_SEC=1 lib_deps = ${esp32s3_base.lib_deps} - https://github.com/meshtastic/GxEPD2 + https://github.com/meshtastic/GxEPD2/archive/33db3fa8ee6fc47d160bdb44f8f127c9a9203a10.zip [env:crowpanel-esp32s3-2-epaper] extends = esp32s3_base @@ -80,4 +80,4 @@ build_flags = ;-DEINK_LIMIT_RATE_RESPONSIVE_SEC=1 lib_deps = ${esp32s3_base.lib_deps} - https://github.com/meshtastic/GxEPD2 + https://github.com/meshtastic/GxEPD2/archive/33db3fa8ee6fc47d160bdb44f8f127c9a9203a10.zip diff --git a/variants/heltec_mesh_node_t114/platformio.ini b/variants/heltec_mesh_node_t114/platformio.ini index 1b06c7f5e..4f83d8516 100644 --- a/variants/heltec_mesh_node_t114/platformio.ini +++ b/variants/heltec_mesh_node_t114/platformio.ini @@ -14,4 +14,4 @@ build_src_filter = ${nrf52_base.build_src_filter} +<../variants/heltec_mesh_node lib_deps = ${nrf52840_base.lib_deps} lewisxhe/PCF8563_Library@^1.0.1 - https://github.com/meshtastic/st7789#bd33ea58ddfe4a5e4a66d53300ccbd38d66ac21f \ No newline at end of file + https://github.com/meshtastic/st7789/archive/bd33ea58ddfe4a5e4a66d53300ccbd38d66ac21f.zip \ No newline at end of file diff --git a/variants/heltec_vision_master_e213/platformio.ini b/variants/heltec_vision_master_e213/platformio.ini index 4bed30324..037d10168 100644 --- a/variants/heltec_vision_master_e213/platformio.ini +++ b/variants/heltec_vision_master_e213/platformio.ini @@ -16,7 +16,7 @@ build_flags = -DEINK_HASQUIRK_GHOSTING ; Display model is identified as "prone to ghosting" lib_deps = ${esp32s3_base.lib_deps} - https://github.com/meshtastic/GxEPD2#b202ebfec6a4821e098cf7a625ba0f6f2400292d + https://github.com/meshtastic/GxEPD2/archive/b202ebfec6a4821e098cf7a625ba0f6f2400292d.zip lewisxhe/PCF8563_Library@^1.0.1 upload_speed = 115200 diff --git a/variants/heltec_vision_master_e290/platformio.ini b/variants/heltec_vision_master_e290/platformio.ini index d28c2015b..6952e9f9e 100644 --- a/variants/heltec_vision_master_e290/platformio.ini +++ b/variants/heltec_vision_master_e290/platformio.ini @@ -20,7 +20,7 @@ build_flags = lib_deps = ${esp32s3_base.lib_deps} - https://github.com/meshtastic/GxEPD2#448c8538129fde3d02a7cb5e6fc81971ad92547f + https://github.com/meshtastic/GxEPD2/archive/448c8538129fde3d02a7cb5e6fc81971ad92547f.zip lewisxhe/PCF8563_Library@^1.0.1 upload_speed = 115200 diff --git a/variants/heltec_vision_master_t190/platformio.ini b/variants/heltec_vision_master_t190/platformio.ini index 53b56f57d..7f55a1be7 100644 --- a/variants/heltec_vision_master_t190/platformio.ini +++ b/variants/heltec_vision_master_t190/platformio.ini @@ -9,5 +9,5 @@ build_flags = lib_deps = ${esp32s3_base.lib_deps} lewisxhe/PCF8563_Library@^1.0.1 - https://github.com/meshtastic/st7789#bd33ea58ddfe4a5e4a66d53300ccbd38d66ac21f + https://github.com/meshtastic/st7789/archive/bd33ea58ddfe4a5e4a66d53300ccbd38d66ac21f.zip upload_speed = 921600 \ No newline at end of file diff --git a/variants/heltec_wireless_paper/platformio.ini b/variants/heltec_wireless_paper/platformio.ini index bd25a932a..51430ebff 100644 --- a/variants/heltec_wireless_paper/platformio.ini +++ b/variants/heltec_wireless_paper/platformio.ini @@ -17,7 +17,7 @@ build_flags = -D EINK_HASQUIRK_GHOSTING ; Display model is identified as "prone to ghosting" lib_deps = ${esp32s3_base.lib_deps} - https://github.com/meshtastic/GxEPD2#b202ebfec6a4821e098cf7a625ba0f6f2400292d + https://github.com/meshtastic/GxEPD2/archive/b202ebfec6a4821e098cf7a625ba0f6f2400292d.zip lewisxhe/PCF8563_Library@^1.0.1 upload_speed = 115200 diff --git a/variants/heltec_wireless_paper_v1/platformio.ini b/variants/heltec_wireless_paper_v1/platformio.ini index ec5fe2408..44b0606af 100644 --- a/variants/heltec_wireless_paper_v1/platformio.ini +++ b/variants/heltec_wireless_paper_v1/platformio.ini @@ -15,6 +15,6 @@ build_flags = -D EINK_LIMIT_GHOSTING_PX=2000 ; (Optional) How much image ghosting is tolerated lib_deps = ${esp32s3_base.lib_deps} - https://github.com/meshtastic/GxEPD2#55f618961db45a23eff0233546430f1e5a80f63a + https://github.com/meshtastic/GxEPD2/archive/55f618961db45a23eff0233546430f1e5a80f63a.zip lewisxhe/PCF8563_Library@^1.0.1 upload_speed = 115200 \ No newline at end of file diff --git a/variants/meshlink/platformio.ini b/variants/meshlink/platformio.ini index 180dddd49..ec3506b0e 100644 --- a/variants/meshlink/platformio.ini +++ b/variants/meshlink/platformio.ini @@ -23,7 +23,7 @@ build_flags = ${nrf52840_base.build_flags} -I variants/meshlink -D MESHLINK build_src_filter = ${nrf52_base.build_src_filter} +<../variants/meshlink> lib_deps = ${nrf52840_base.lib_deps} - https://github.com/meshtastic/GxEPD2#55f618961db45a23eff0233546430f1e5a80f63a + https://github.com/meshtastic/GxEPD2/archive/55f618961db45a23eff0233546430f1e5a80f63a.zip debug_tool = jlink ; If not set we will default to uploading over serial (first it forces bootloader entry by talking 1200bps to cdcacm) ; Note: as of 6/2013 the serial/bootloader based programming takes approximately 30 seconds diff --git a/variants/meshlink_eink/platformio.ini b/variants/meshlink_eink/platformio.ini index db3647e73..f8ee96fc3 100644 --- a/variants/meshlink_eink/platformio.ini +++ b/variants/meshlink_eink/platformio.ini @@ -23,7 +23,7 @@ build_flags = ${nrf52840_base.build_flags} -I variants/meshlink_eink -D MESHLINK build_src_filter = ${nrf52_base.build_src_filter} +<../variants/meshlink_eink> lib_deps = ${nrf52840_base.lib_deps} - https://github.com/meshtastic/GxEPD2#55f618961db45a23eff0233546430f1e5a80f63a + https://github.com/meshtastic/GxEPD2/archive/55f618961db45a23eff0233546430f1e5a80f63a.zip debug_tool = jlink ; If not set we will default to uploading over serial (first it forces bootloader entry by talking 1200bps to cdcacm) ; Note: as of 6/2013 the serial/bootloader based programming takes approximately 30 seconds diff --git a/variants/monteops_hw1/platformio.ini b/variants/monteops_hw1/platformio.ini index eaa246526..1464ca7e7 100644 --- a/variants/monteops_hw1/platformio.ini +++ b/variants/monteops_hw1/platformio.ini @@ -9,7 +9,7 @@ build_src_filter = ${nrf52_base.build_src_filter} +<../variants/monteops_hw1> +< lib_deps = ${nrf52840_base.lib_deps} ${networking_base.lib_deps} - https://github.com/RAKWireless/RAK13800-W5100S.git#1.0.2 + https://github.com/RAKWireless/RAK13800-W5100S/archive/1.0.2.zip debug_tool = jlink ; If not set we will default to uploading over serial (first it forces bootloader entry by talking 1200bps to cdcacm) ;upload_protocol = jlink diff --git a/variants/radiomaster_900_bandit/platformio.ini b/variants/radiomaster_900_bandit/platformio.ini index 010791d8a..f87025937 100644 --- a/variants/radiomaster_900_bandit/platformio.ini +++ b/variants/radiomaster_900_bandit/platformio.ini @@ -13,4 +13,4 @@ board_build.f_cpu = 240000000L upload_protocol = esptool lib_deps = ${esp32_base.lib_deps} - https://github.com/gjelsoe/STK8xxx-Accelerometer.git#v0.1.1 + https://github.com/gjelsoe/STK8xxx-Accelerometer/archive/v0.1.1.zip diff --git a/variants/rak11310/platformio.ini b/variants/rak11310/platformio.ini index 6e718a651..c87304e61 100644 --- a/variants/rak11310/platformio.ini +++ b/variants/rak11310/platformio.ini @@ -15,6 +15,6 @@ lib_deps = ${rp2040_base.lib_deps} ${networking_base.lib_deps} melopero/Melopero RV3028@^1.1.0 - https://github.com/RAKWireless/RAK13800-W5100S.git#1.0.2 + https://github.com/RAKWireless/RAK13800-W5100S/archive/1.0.2.zip debug_build_flags = ${rp2040_base.build_flags}, -g debug_tool = cmsis-dap ; for e.g. Picotool \ No newline at end of file diff --git a/variants/rak2560/platformio.ini b/variants/rak2560/platformio.ini index 956f573c5..faed231f1 100644 --- a/variants/rak2560/platformio.ini +++ b/variants/rak2560/platformio.ini @@ -15,7 +15,7 @@ lib_deps = ${nrf52840_base.lib_deps} ${networking_base.lib_deps} melopero/Melopero RV3028@^1.1.0 - https://github.com/beegee-tokyo/RAK-OneWireSerial.git#0.0.2 + https://github.com/beegee-tokyo/RAK-OneWireSerial/archive/0.0.2.zip debug_tool = jlink ; If not set we will default to uploading over serial (first it forces bootloader entry by talking 1200bps to cdcacm) ;upload_protocol = jlink diff --git a/variants/rak4631/platformio.ini b/variants/rak4631/platformio.ini index 474de8bed..21dfc3b81 100644 --- a/variants/rak4631/platformio.ini +++ b/variants/rak4631/platformio.ini @@ -17,11 +17,12 @@ lib_deps = ${nrf52840_base.lib_deps} ${networking_base.lib_deps} melopero/Melopero RV3028@^1.1.0 - https://github.com/RAKWireless/RAK13800-W5100S.git#1.0.2 + https://github.com/RAKWireless/RAK13800-W5100S/archive/1.0.2.zip rakwireless/RAKwireless NCP5623 RGB LED library@^1.0.2 - https://github.com/RAKWireless/RAK12034-BMX160.git#dcead07ffa267d3c906e9ca4a1330ab989e957e2 + https://github.com/RAKWireless/RAK12034-BMX160/archive/dcead07ffa267d3c906e9ca4a1330ab989e957e2.zip https://github.com/Woutvstk/SdFat_wrapper25.git#6f8f48d56c15cbeac753560dfeede4a487f81f4c + ; If not set we will default to uploading over serial (first it forces bootloader entry by talking 1200bps to cdcacm) ; Note: as of 6/2013 the serial/bootloader based programming takes approximately 30 seconds ;upload_protocol = jlink @@ -42,7 +43,7 @@ build_flags = lib_deps = ${env:rak4631.lib_deps} - https://github.com/geeksville/Armduino-Semihosting.git#35b538fdf208c3530c1434cd099a08e486672ee4 + https://github.com/geeksville/Armduino-Semihosting/archive/35b538fdf208c3530c1434cd099a08e486672ee4.zip ; NOTE: the pyocd support for semihosting is buggy. So I switched to using the builtin platformio support for the stlink adapter which worked much better. ; However the built in openocd version in platformio has buggy support for TCP to semihosting. diff --git a/variants/rak4631_eth_gw/platformio.ini b/variants/rak4631_eth_gw/platformio.ini index a624d0381..e3da21c55 100644 --- a/variants/rak4631_eth_gw/platformio.ini +++ b/variants/rak4631_eth_gw/platformio.ini @@ -27,9 +27,9 @@ lib_deps = ${nrf52840_base.lib_deps} ${networking_base.lib_deps} melopero/Melopero RV3028@^1.1.0 - https://github.com/RAKWireless/RAK13800-W5100S.git#1.0.2 + https://github.com/RAKWireless/RAK13800-W5100S/archive/1.0.2.zip rakwireless/RAKwireless NCP5623 RGB LED library@^1.0.2 - https://github.com/meshtastic/RAK12034-BMX160.git#4821355fb10390ba8557dc43ca29a023bcfbb9d9 + https://github.com/meshtastic/RAK12034-BMX160/archive/4821355fb10390ba8557dc43ca29a023bcfbb9d9.zip bblanchon/ArduinoJson @ 6.21.4 ; If not set we will default to uploading over serial (first it forces bootloader entry by talking 1200bps to cdcacm) ; Note: as of 6/2013 the serial/bootloader based programming takes approximately 30 seconds @@ -51,7 +51,7 @@ build_flags = lib_deps = ${env:rak4631_eth_gw.lib_deps} - https://github.com/geeksville/Armduino-Semihosting.git#35b538fdf208c3530c1434cd099a08e486672ee4 + https://github.com/geeksville/Armduino-Semihosting/archive/35b538fdf208c3530c1434cd099a08e486672ee4.zip ; NOTE: the pyocd support for semihosting is buggy. So I switched to using the builtin platformio support for the stlink adapter which worked much better. ; However the built in openocd version in platformio has buggy support for TCP to semihosting. diff --git a/variants/rak_wismeshtap/platformio.ini b/variants/rak_wismeshtap/platformio.ini index bcf46b90d..78472783e 100644 --- a/variants/rak_wismeshtap/platformio.ini +++ b/variants/rak_wismeshtap/platformio.ini @@ -18,7 +18,7 @@ lib_deps = ${nrf52840_base.lib_deps} ${networking_base.lib_deps} melopero/Melopero RV3028@^1.1.0 - https://github.com/RAKWireless/RAK13800-W5100S.git#1.0.2 + https://github.com/RAKWireless/RAK13800-W5100S/archive/1.0.2.zip rakwireless/RAKwireless NCP5623 RGB LED library@^1.0.2 bodmer/TFT_eSPI beegee-tokyo/RAKwireless RAK12034@^1.0.0 diff --git a/variants/seeed-sensecap-indicator/platformio.ini b/variants/seeed-sensecap-indicator/platformio.ini index da11953b7..fb51d77c3 100644 --- a/variants/seeed-sensecap-indicator/platformio.ini +++ b/variants/seeed-sensecap-indicator/platformio.ini @@ -2,7 +2,7 @@ [env:seeed-sensecap-indicator] extends = esp32s3_base platform_packages = - platformio/framework-arduinoespressif32 @ https://github.com/mverch67/arduino-esp32.git#aef7fef6de3329ed6f75512d46d63bba12b09bb5 ; add_tca9535 (based on 2.0.16) + platformio/framework-arduinoespressif32 @ https://github.com/mverch67/arduino-esp32/archive/aef7fef6de3329ed6f75512d46d63bba12b09bb5.zip ; add_tca9535 (based on 2.0.16) board = seeed-sensecap-indicator board_check = true @@ -24,7 +24,7 @@ build_flags = ${esp32_base.build_flags} -DUSE_ARDUINO_HAL_GPIO lib_deps = ${esp32s3_base.lib_deps} - https://github.com/mverch67/LovyanGFX#develop + https://github.com/mverch67/LovyanGFX/archive/4c76238c1344162a234ae917b27651af146d6fb2.zip earlephilhower/ESP8266Audio@^1.9.9 earlephilhower/ESP8266SAM@^1.0.1 @@ -49,7 +49,7 @@ build_flags = -D HAS_SCREEN=0 -D HAS_TFT=1 -D DISPLAY_SET_RESOLUTION - -D USE_I2S_BUZZER + -D USE_PIN_BUZZER -D RAM_SIZE=4096 -D LV_LVGL_H_INCLUDE_SIMPLE -D LV_CONF_INCLUDE_SIMPLE @@ -65,10 +65,9 @@ build_flags = -D LGFX_DRIVER=LGFX_INDICATOR -D GFX_DRIVER_INC=\"graphics/LGFX/LGFX_INDICATOR.h\" -D VIEW_320x240 -; -D USE_DOUBLE_BUFFER -D USE_PACKET_API lib_deps = ${env:seeed-sensecap-indicator.lib_deps} ${device-ui_base.lib_deps} - https://github.com/bitbank2/bb_captouch.git#8f2f06462ff597847921739376a299db93612417 ; alternative touch library supporting FT6x36 + https://github.com/mverch67/bb_captouch/archive/8626412fe650d808a267791c0eae6e5860c85a5d.zip ; alternative touch library supporting FT6x36 diff --git a/variants/t-echo/platformio.ini b/variants/t-echo/platformio.ini index e01befb45..59fd52ccd 100644 --- a/variants/t-echo/platformio.ini +++ b/variants/t-echo/platformio.ini @@ -20,7 +20,7 @@ build_flags = ${nrf52840_base.build_flags} -Ivariants/t-echo build_src_filter = ${nrf52_base.build_src_filter} +<../variants/t-echo> lib_deps = ${nrf52840_base.lib_deps} - https://github.com/meshtastic/GxEPD2#55f618961db45a23eff0233546430f1e5a80f63a + https://github.com/meshtastic/GxEPD2/archive/55f618961db45a23eff0233546430f1e5a80f63a.zip lewisxhe/PCF8563_Library@^1.0.1 ;upload_protocol = fs diff --git a/variants/t-eth-elite/platformio.ini b/variants/t-eth-elite/platformio.ini index ec6c82a5d..d6f415f3d 100644 --- a/variants/t-eth-elite/platformio.ini +++ b/variants/t-eth-elite/platformio.ini @@ -14,4 +14,4 @@ lib_ignore = lib_deps = ${esp32s3_base.lib_deps} - https://github.com/meshtastic/ETHClass2#v1.0.0 + https://github.com/meshtastic/ETHClass2/archive/v1.0.0.zip diff --git a/variants/tlora_t3s3_epaper/platformio.ini b/variants/tlora_t3s3_epaper/platformio.ini index 3f3b3fe50..87351e586 100644 --- a/variants/tlora_t3s3_epaper/platformio.ini +++ b/variants/tlora_t3s3_epaper/platformio.ini @@ -15,4 +15,4 @@ build_flags = lib_deps = ${esp32s3_base.lib_deps} - https://github.com/meshtastic/GxEPD2#b202ebfec6a4821e098cf7a625ba0f6f2400292d + https://github.com/meshtastic/GxEPD2/archive/b202ebfec6a4821e098cf7a625ba0f6f2400292d.zip diff --git a/variants/tracker-t1000-e/platformio.ini b/variants/tracker-t1000-e/platformio.ini index 0bce9fbb5..8c3c97e6c 100644 --- a/variants/tracker-t1000-e/platformio.ini +++ b/variants/tracker-t1000-e/platformio.ini @@ -9,7 +9,7 @@ board_build.ldscript = src/platform/nrf52/nrf52840_s140_v7.ld build_src_filter = ${nrf52_base.build_src_filter} +<../variants/tracker-t1000-e> lib_deps = ${nrf52840_base.lib_deps} - https://github.com/meshtastic/QMA6100P_Arduino_Library.git#14c900b8b2e4feaac5007a7e41e0c1b7f0841136 + https://github.com/meshtastic/QMA6100P_Arduino_Library/archive/14c900b8b2e4feaac5007a7e41e0c1b7f0841136.zip debug_tool = jlink ; If not set we will default to uploading over serial (first it forces bootloader entry by talking 1200bps to cdcacm) upload_protocol = nrfutil \ No newline at end of file diff --git a/variants/xiao_ble/variant.h b/variants/xiao_ble/variant.h index a86ddfde2..d00f8be89 100644 --- a/variants/xiao_ble/variant.h +++ b/variants/xiao_ble/variant.h @@ -143,9 +143,10 @@ static const uint8_t SCK = PIN_SPI_SCK; #define SX126X_DIO2_AS_RF_SWITCH #define SX126X_DIO3_TCXO_VOLTAGE 1.8 #ifdef EBYTE_E22_900M30S -// 10dB PA gain and 30dB rated output; based on PA output table from Ebyte Robin -#define REGULATORY_GAIN_LORA 10 -#define SX126X_MAX_POWER 20 +// 10dB PA gain and 30dB rated output; based on measurements from +// https://github.com/S5NC/EBYTE_ESP32-S3/blob/main/E22-900M30S%20power%20output%20testing.txt +#define REGULATORY_GAIN_LORA 7 +#define SX126X_MAX_POWER 22 #endif #ifdef EBYTE_E22_900M33S // 25dB PA gain and 33dB rated output; based on TX Power Curve from E22-900M33S_UserManual_EN_v1.0.pdf diff --git a/version.properties b/version.properties index 9d6d2a464..0b46aeec6 100644 --- a/version.properties +++ b/version.properties @@ -1,4 +1,4 @@ [VERSION] major = 2 minor = 6 -build = 3 +build = 5