Skip to content

Commit cbaa757

Browse files
committed
update
1 parent c7eb2d9 commit cbaa757

File tree

6 files changed

+36
-22
lines changed

6 files changed

+36
-22
lines changed

code/include/common.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
extern const char* PROG_VERSION;
1515

1616
#ifdef MQTT_USE_SSL
17+
#include <WiFiClientSecure.h>
1718
extern WiFiClientSecure wifiClient;
1819
#else
1920
extern WiFiClient wifiClient;

code/platformio.ini

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
; Please visit documentation for the other options and examples
99
; https://docs.platformio.org/page/projectconf.html
1010

11+
1112
[platformio]
1213
default_envs = esp32dev_mqttssl
1314

@@ -18,14 +19,13 @@ lib_deps_builtin =
1819
lib_deps_ext =
1920
https://github.com/lefty01/ESP32-HUB75-MatrixPanel-I2S-DMA
2021
https://github.com/lefty01/BH1750
21-
;claws/BH1750@^1.3.0
2222
2323
adafruit/Adafruit GFX Library @ ^1.10.6
2424
adafruit/Adafruit BusIO @ ^1.7.2
2525
knolleary/PubSubClient @ ^2.8
2626
bblanchon/ArduinoJson @ ^6.18.0
2727
adafruit/Adafruit TSL2591 Library @ ^1.3.1
28-
adafruit/Adafruit BMP280 [email protected]
28+
; adafruit/Adafruit BMP280 [email protected]
2929
adafruit/Adafruit Unified Sensor@^1.1.4
3030

3131
[env:esp32dev]
@@ -38,12 +38,13 @@ check_skip_packages = yes
3838
lib_deps =
3939
${common_env_data.lib_deps_builtin}
4040
${common_env_data.lib_deps_ext}
41-
41+
adafruit/Adafruit BMP280 Library@^2.6.8
4242
build_flags =
4343
-DPANEL_SIZE_64_x_64=1
4444

4545
[env:esp32dev_mqttssl]
46-
platform = espressif32
46+
platform = https://github.com/pioarduino/platform-espressif32/
47+
;;platform = espressif32
4748
board = esp32dev
4849
framework = arduino
4950
monitor_speed = 115200
@@ -52,11 +53,10 @@ check_skip_packages = yes
5253
lib_deps =
5354
${common_env_data.lib_deps_builtin}
5455
${common_env_data.lib_deps_ext}
55-
56+
adafruit/Adafruit BMP280 Library@^2.6.8
5657
build_flags =
5758
-DMQTT_USE_SSL=1
5859
-DPANEL_SIZE_64_x_64=1
5960
-DMATRIX_HEIGHT=64
6061
-DMATRIX_WIDTH=64
6162
-DLIGHT_SENSOR_BH1750=1
62-
; -DLIGHT_SENSOR_TSL2591=1

code/src/buzzer.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,10 @@
33

44
void buzzer_init() {
55
pinMode(BUZZER_PIN, OUTPUT);
6-
ledcSetup(BUZZER_PWM_CHANNEL, 1000, BUZZER_PWM_RESOLUTION);
7-
ledcAttachPin(BUZZER_PIN, BUZZER_PWM_CHANNEL);
6+
//ledcSetup(BUZZER_PWM_CHANNEL, 1000, BUZZER_PWM_RESOLUTION);
7+
//ledcAttachPin(BUZZER_PIN, BUZZER_PWM_CHANNEL);
8+
9+
ledcAttach(BUZZER_PIN, 1000, BUZZER_PWM_RESOLUTION);
810
}
911

1012
void buzzer_tone(double freq, uint32_t durationMs) {

code/src/digit.cpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,16 @@ const uint16_t height = PANEL_HEIGHT-1;
1414
const uint16_t width = PANEL_WIDTH-1;
1515

1616
byte digitBits[] = {
17-
B11111100, // 0 ABCDEF--
18-
B01100000, // 1 -BC-----
19-
B11011010, // 2 AB-DE-G-
20-
B11110010, // 3 ABCD--G-
21-
B01100110, // 4 -BC--FG-
22-
B10110110, // 5 A-CD-FG-
23-
B10111110, // 6 A-CDEFG-
24-
B11100000, // 7 ABC-----
25-
B11111110, // 8 ABCDEFG-
26-
B11110110, // 9 ABCD_FG-
17+
0b11111100, // 0 ABCDEF--
18+
0b01100000, // 1 -BC-----
19+
0b11011010, // 2 AB-DE-G-
20+
0b11110010, // 3 ABCD--G-
21+
0b01100110, // 4 -BC--FG-
22+
0b10110110, // 5 A-CD-FG-
23+
0b10111110, // 6 A-CDEFG-
24+
0b11100000, // 7 ABC-----
25+
0b11111110, // 8 ABCDEFG-
26+
0b11110110, // 9 ABCD_FG-
2727
};
2828

2929
//byte sunBitmap[] {

code/src/main.cpp

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,13 @@ unsigned long lastWeatherUpdate;
4444
//Just a blinking heart to show the main thread is still alive...
4545
bool blinkOn;
4646

47+
//#define CONFIG_FREERTOS_NUMBER_OF_CORES 1
48+
esp_task_wdt_config_t twdt_config = {
49+
.timeout_ms = WDT_TIMEOUT,
50+
.idle_core_mask = (1 << CONFIG_FREERTOS_NUMBER_OF_CORES) - 1, // Bitmask of all cores
51+
.trigger_panic = true,
52+
};
53+
4754
void setup(){
4855
display_init();
4956

@@ -97,8 +104,12 @@ void setup(){
97104
delay(500);
98105

99106
logStatusMessage("Setting up watchdog...");
100-
esp_task_wdt_init(WDT_TIMEOUT, true);
101-
esp_task_wdt_add(NULL);
107+
108+
esp_task_wdt_deinit(); //wdt is enabled by default, so we need to deinit it first
109+
esp_task_wdt_init(&twdt_config); //enable panic so ESP32 restarts
110+
esp_task_wdt_add(NULL); //add current thread to WDT watch
111+
// deprecated: esp_task_wdt_init(WDT_TIMEOUT, true);
112+
// deprecated: esp_task_wdt_add(NULL);
102113
logStatusMessage("Woof!");
103114

104115
//logStatusMessage(WiFi.localIP().toString());

code/src/mqtt.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,8 @@ void reconnect() {
7777
if ( status != WL_CONNECTED) {
7878
WiFi.begin(WIFI_SSID, WIFI_PASSWORD);
7979
while (WiFi.status() != WL_CONNECTED) {
80-
delay(500);
81-
Serial.print(".");
80+
delay(500);
81+
Serial.print(".");
8282
}
8383
Serial.println("Connected to AP");
8484
logStatusMessage("MQTT lost");

0 commit comments

Comments
 (0)