Skip to content

Commit

Permalink
fixed issues on ESP32S3 around the HW enable pin. (Pio refactor)
Browse files Browse the repository at this point in the history
  • Loading branch information
hpsaturn committed Dec 29, 2023
1 parent 052141e commit 209296a
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 21 deletions.
40 changes: 22 additions & 18 deletions platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ extra_scripts = pre:prebuild.py
build_flags =
-D CORE_DEBUG_LEVEL=0 # For debugging set to 3 and enable debug mode in the app
-D MIN_PUBLISH_INTERVAL=30 # Minimum interval between clouds updates
-D MAIN_HW_EN_PIN=27 # enable the main hardware pin (main sensor)
-D WAIT_FOR_PM_SENSOR=25 # time of stabilization of PM sensors in seconds
-D ARDUINO_ESP32_DEV=1 # compatibilty for DFRobot NH3/CO library
-D DISABLE_ALL_LIBRARY_WARNINGS=1
Expand All @@ -54,11 +53,13 @@ board = lolin32
framework = ${common.framework}
upload_speed = ${common.upload_speed}
monitor_speed = ${common.monitor_speed}
build_flags = ${common.build_flags}
lib_deps = ${common.lib_deps}
monitor_filters = ${common.monitor_filters}
extra_scripts = ${common.extra_scripts}
board_build.partitions = min_spiffs.csv
build_flags =
${common.build_flags}
-D MAIN_HW_EN_PIN=27 # enable the main hardware pin (main sensor)

[oled_common]
extends = esp32_common
Expand Down Expand Up @@ -150,12 +151,14 @@ board = seeed_xiao_esp32c3

[esp32s3_common]
extends = oled_common
platform = espressif32 @ 6.5.0
board = esp32-s3-devkitc-1
board_build.mcu = esp32s3
board_build.f_cpu = 240000000L
build_flags =
${common.build_flags}
-DBOARD_HAS_PSRAM=1
${common.build_flags}
-D BOARD_HAS_PSRAM=1
-D MAIN_HW_EN_PIN=3 # enable the main hardware pin (main sensor)

; ESP32S3 DEVKIT (Also ESP32S3 CAM)
[env:ESP32S3]
Expand All @@ -164,7 +167,8 @@ extends = esp32s3_common
[env:TTGO_T7S3]
extends = esp32s3_common
build_flags =
${common.build_flags}
${common.build_flags}
-D MAIN_HW_EN_PIN=3 # enable the main hardware pin (main sensor)
-D ARDUINO_USB_CDC_ON_BOOT=1

[env:LORADEVKIT]
Expand All @@ -181,17 +185,17 @@ lib_deps =
;sabas1080/CayenneLPP @ ^1.1.0
https://github.com/ElectronicCats/CayenneLPP
build_flags =
${common.build_flags}
-D RXD2=23
-D TXD2=17
-D hal_init=LMICHAL_init
-D ARDUINO_LMIC_PROJECT_CONFIG_H_SUPPRESS
-D CFG_eu868=1
-D CFG_sx1276_radio=1
-D LMIC_PRINTF_TO=Serial
-D LMIC_DEBUG_LEVEL=2
-D DISABLE_PING=1
-D DISABLE_BEACONS=1
-D ARDUINO_SAMD_VARIANT_COMPLIANCE=1
-D TTGOLORA32V1
${common.build_flags}
-D RXD2=23
-D TXD2=17
-D hal_init=LMICHAL_init
-D ARDUINO_LMIC_PROJECT_CONFIG_H_SUPPRESS
-D CFG_eu868=1
-D CFG_sx1276_radio=1
-D LMIC_PRINTF_TO=Serial
-D LMIC_DEBUG_LEVEL=2
-D DISABLE_PING=1
-D DISABLE_BEACONS=1
-D ARDUINO_SAMD_VARIANT_COMPLIANCE=1
-D TTGOLORA32V1
;lib_ignore = gui-utils-tft
4 changes: 1 addition & 3 deletions src/power.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,7 @@ void powerInit() {
WRITE_PERI_REG(RTC_CNTL_BROWN_OUT_REG, 0); // Disable Brownout Detector
// set cpu speed low to save battery
setCpuFrequencyMhz(240);
Serial.print("-->[POWR] CPU Speed: ");
Serial.print(getCpuFrequencyMhz());
Serial.println(" MHz");
Serial.printf("-->[POWR] CPU Speed:%i MHz\r\n",getCpuFrequencyMhz());
powerEnableSensors();
}

Expand Down

0 comments on commit 209296a

Please sign in to comment.