Skip to content

Commit 4f08cde

Browse files
committed
Upgrade to Arduino Core 3.0.1
All BearSSL ciphers enabled, TLS 1.2 set as minimum version Libraries updated (incl. changes needed)
1 parent 5bd5791 commit 4f08cde

File tree

2 files changed

+28
-34
lines changed

2 files changed

+28
-34
lines changed

airrohr-firmware/airrohr-firmware.ino

Lines changed: 19 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
************************************************************************
77
* *
88
* airRohr firmware *
9-
* Copyright (C) 2016-2020 Code for Stuttgart a.o. *
9+
* Copyright (C) 2016-2021 Code for Stuttgart a.o. *
1010
* Copyright (C) 2019-2020 Dirk Mueller *
1111
* *
1212
* This program is free software: you can redistribute it and/or modify *
@@ -45,22 +45,12 @@
4545
* *
4646
* Please check Readme.md for other sensors and hardware *
4747
* *
48-
************************************************************************
49-
*
50-
* latest mit lib 2.6.1
51-
* DATA: [==== ] 40.7% (used 33316 bytes from 81920 bytes)
52-
* PROGRAM: [===== ] 49.3% (used 514788 bytes from 1044464 bytes)
53-
54-
* latest mit lib 2.5.2
55-
* DATA: [==== ] 39.4% (used 32304 bytes from 81920 bytes)
56-
* PROGRAM: [===== ] 48.3% (used 504812 bytes from 1044464 bytes)
57-
*
5848
************************************************************************/
5949
#include <WString.h>
6050
#include <pgmspace.h>
6151

6252
// increment on change
63-
#define SOFTWARE_VERSION_STR "NRZ-2020-134-B3"
53+
#define SOFTWARE_VERSION_STR "NRZ-2020-134-B4"
6454
String SOFTWARE_VERSION(SOFTWARE_VERSION_STR);
6555

6656
/*****************************************************************
@@ -374,6 +364,7 @@ unsigned long last_update_attempt;
374364
int last_update_returncode;
375365
int last_sendData_returncode;
376366

367+
377368
float last_value_BMP_T = -128.0;
378369
float last_value_BMP_P = -1.0;
379370
float last_value_BMX280_T = -128.0;
@@ -618,8 +609,8 @@ static void disable_unneeded_nmea() {
618609

619610
/* backward compatibility for the times when we stored booleans as strings */
620611
static bool boolFromJSON(const DynamicJsonDocument& json, const __FlashStringHelper* key) {
621-
if (json[key].is<char*>()) {
622-
return !strcmp_P(json[key].as<char*>(), PSTR("true"));
612+
if (json[key].is<const char*>()) {
613+
return !strcmp_P(json[key].as<const char*>(), PSTR("true"));
623614
}
624615
return json[key].as<bool>();
625616
}
@@ -668,12 +659,12 @@ static void readConfig(bool oldconfig = false) {
668659
break;
669660
case Config_Type_String:
670661
case Config_Type_Password:
671-
strncpy(c.cfg_val.as_str, json[c.cfg_key()].as<char*>(), c.cfg_len);
662+
strncpy(c.cfg_val.as_str, json[c.cfg_key()].as<const char*>(), c.cfg_len);
672663
c.cfg_val.as_str[c.cfg_len] = '\0';
673664
break;
674665
};
675666
}
676-
String writtenVersion(json["SOFTWARE_VERSION"].as<char*>());
667+
String writtenVersion(json["SOFTWARE_VERSION"].as<const char*>());
677668
if (writtenVersion.length() && writtenVersion[0] == 'N' && SOFTWARE_VERSION != writtenVersion) {
678669
debug_outln_info(F("Rewriting old config from: "), writtenVersion);
679670
// would like to do that, but this would wipe firmware.old which the two stage loader
@@ -976,7 +967,7 @@ static String form_select_lang() {
976967
"<option value='RS'>Srpski (RS)</option>"
977968
"<option value='RU'>Русский (RU)</option>"
978969
"<option value='SI'>Slovenščina (SI)</option>"
979-
"<option value='SK'>Slovenský (SK)</option>"
970+
"<option value='SK'>Slovák (SK)</option>"
980971
"<option value='SE'>Svenska (SE)</option>"
981972
"<option value='TR'>Türkçe (TR)</option>"
982973
"<option value='UA'>український (UA)</option>"
@@ -1901,11 +1892,11 @@ static void webserver_metrics_endpoint() {
19011892
DeserializationError err = deserializeJson(json2data, last_data_string);
19021893
if (!err) {
19031894
for (JsonObject measurement : json2data[FPSTR(JSON_SENSOR_DATA_VALUES)].as<JsonArray>()) {
1904-
page_content += measurement["value_type"].as<char*>();
1895+
page_content += measurement["value_type"].as<const char*>();
19051896
page_content += '{';
19061897
page_content += id;
19071898
page_content += "} ";
1908-
page_content += measurement["value"].as<char*>();
1899+
page_content += measurement["value"].as<const char*>();
19091900
page_content += '\n';
19101901
}
19111902
page_content += F("last_sample_age_ms{");
@@ -2231,6 +2222,7 @@ static WiFiClient* getNewLoggerWiFiClient(const LoggerEntry logger) {
22312222
#if defined(ESP8266)
22322223
static_cast<WiFiClientSecure*>(_client)->setSession(loggerConfigs[logger].session);
22332224
static_cast<WiFiClientSecure*>(_client)->setBufferSizes(1024, TCP_MSS > 1024 ? 2048 : 1024);
2225+
static_cast<WiFiClientSecure*>(_client)->setSSLVersion(BR_TLS12, BR_TLS12);
22342226
switch (logger) {
22352227
case Loggeraircms:
22362228
case LoggerInflux:
@@ -2353,16 +2345,16 @@ static void create_influxdb_string_from_data(String& data_4_influxdb, const Stri
23532345
data_4_influxdb += F(",node=" SENSOR_BASENAME);
23542346
data_4_influxdb += esp_chipid + " ";
23552347
for (JsonObject measurement : json2data[FPSTR(JSON_SENSOR_DATA_VALUES)].as<JsonArray>()) {
2356-
data_4_influxdb += measurement["value_type"].as<char*>();
2348+
data_4_influxdb += measurement["value_type"].as<const char*>();
23572349
data_4_influxdb += "=";
23582350

23592351
if (isNumeric(measurement["value"])) {
23602352
//send numerics without quotes
2361-
data_4_influxdb += measurement["value"].as<char*>();
2353+
data_4_influxdb += measurement["value"].as<const char*>();
23622354
} else {
23632355
//quote string values
23642356
data_4_influxdb += "\"";
2365-
data_4_influxdb += measurement["value"].as<char*>();
2357+
data_4_influxdb += measurement["value"].as<const char*>();
23662358
data_4_influxdb += "\"";
23672359
}
23682360
data_4_influxdb += ",";
@@ -2389,9 +2381,9 @@ static void send_csv(const String& data) {
23892381
String valueline(act_milli);
23902382
valueline += ';';
23912383
for (JsonObject measurement : json2data[FPSTR(JSON_SENSOR_DATA_VALUES)].as<JsonArray>()) {
2392-
headline += measurement["value_type"].as<char*>();
2384+
headline += measurement["value_type"].as<const char*>();
23932385
headline += ';';
2394-
valueline += measurement["value"].as<char*>();
2386+
valueline += measurement["value"].as<const char*>();
23952387
valueline += ';';
23962388
}
23972389
static bool first_csv_line = true;
@@ -2514,7 +2506,7 @@ static void fetchSensorSHT3x(String& s) {
25142506
}
25152507

25162508
/*****************************************************************
2517-
* read SHT3x sensor values *
2509+
* read SCD30 sensor values *
25182510
*****************************************************************/
25192511
static void fetchSensorSCD30(String& s) {
25202512
debug_outln_verbose(FPSTR(DBG_TXT_START_READING), FPSTR(SENSORS_SCD30));
@@ -2964,6 +2956,7 @@ static __noinline void fetchSensorHPM(String& s) {
29642956
/*****************************************************************
29652957
* read Tera Sensor Next PM sensor sensor values *
29662958
*****************************************************************/
2959+
/* Disabled
29672960
static void fetchSensorNPM(String& s) {
29682961
29692962
debug_outln_verbose(FPSTR(DBG_TXT_START_READING), FPSTR(SENSORS_NPM));
@@ -3252,6 +3245,7 @@ static void fetchSensorNPM(String& s) {
32523245
32533246
debug_outln_verbose(FPSTR(DBG_TXT_END_READING), FPSTR(SENSORS_NPM));
32543247
}
3248+
*/
32553249

32563250
/*****************************************************************
32573251
* read PPD42NS sensor values *

airrohr-firmware/platformio.ini

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ src_dir = .
2121

2222
[common]
2323
build_flags =
24-
-DVTABLES_IN_FLASH -D BEARSSL_SSL_BASIC
24+
-DVTABLES_IN_FLASH
2525
-D PIO_FRAMEWORK_ARDUINO_LWIP2_HIGHER_BANDWIDTH
2626
-D HTTPCLIENT_1_1_COMPATIBLE=0 -D NO_GLOBAL_SERIAL=0
2727
-DNDEBUG -DFP_IN_IROM -frandom-seed=b61f78373
@@ -46,12 +46,12 @@ lib_deps_external =
4646
paulstoffregen/[email protected]
4747
marcoschwartz/[email protected]
4848
adafruit/Adafruit BMP085 [email protected]
49-
adafruit/Adafruit HTU21DF [email protected].2
50-
adafruit/Adafruit SHT31 Library@1.1.6
51-
milesburton/DallasTemperature@3.8.0
52-
sparkfun/SparkFun SCD30 Arduino Library @ ^1.0.12
53-
bblanchon/ArduinoJson@6.16.1
54-
ThingPulse/ESP8266 and ESP32 OLED driver for SSD1306 displays @ ^4.2.0
49+
adafruit/Adafruit HTU21DF [email protected].5
50+
adafruit/Adafruit SHT31 Library@1.2.0
51+
milesburton/DallasTemperature@3.9.1
52+
sparkfun/SparkFun SCD30 Arduino Library @ ^1.0.13
53+
bblanchon/ArduinoJson@6.18.3
54+
ThingPulse/ESP8266 and ESP32 OLED driver for SSD1306 displays @ ^4.2.1
5555
5656

5757
; system libraries from platform -> no version number
@@ -82,11 +82,11 @@ lib_deps_esp8266 = ${common.lib_deps_esp8266_platform} ${common.lib_deps_externa
8282
lib_deps_esp32 = ${common.lib_deps_esp32_platform} ${common.lib_deps_external}
8383

8484
extra_scripts = platformio_script.py
85-
# This release is reflecting the Arduino Core 2.7.4 release
85+
# This release is reflecting the Arduino Core 3.0.1 release
8686
# When the requirement for Arduino Core is raised, this
8787
# needs to be adjusted to the matching version from
8888
# https://github.com/platformio/platform-espressif8266/releases
89-
platform_version = espressif8266@2.6.2
89+
platform_version = espressif8266@3.1.0
9090
platform_version_esp32 = [email protected] ; using Arduino core 1.0.4
9191

9292
[DISABLEDenv:lolin_d32_pro_debug]

0 commit comments

Comments
 (0)