@@ -337,7 +337,6 @@ enum class PmSensorCmd {
337
337
};
338
338
339
339
LoggerConfig loggerConfigs[LoggerCount];
340
- BearSSL::X509List x509_dst_root_ca (dst_root_ca_x3);
341
340
342
341
long int sample_count = 0 ;
343
342
bool htu21d_init_failed = false ;
@@ -1092,30 +1091,35 @@ static void writeConfig() {
1092
1091
* Prepare information for data Loggers *
1093
1092
*****************************************************************/
1094
1093
static void createLoggerConfigs () {
1094
+ #if defined(ESP8266)
1095
+ auto new_session = []() { return new BearSSL::Session; };
1096
+ #else
1097
+ auto new_session = []() { return nullptr ; };
1098
+ #endif
1095
1099
if (cfg::send2dusti) {
1096
1100
loggerConfigs[LoggerSensorCommunity].destport = 80 ;
1097
1101
if (cfg::ssl_dusti) {
1098
1102
loggerConfigs[LoggerSensorCommunity].destport = 443 ;
1099
- loggerConfigs[LoggerSensorCommunity].session = new BearSSL::Session ;
1103
+ loggerConfigs[LoggerSensorCommunity].session = new_session () ;
1100
1104
}
1101
1105
}
1102
1106
loggerConfigs[LoggerMadavi].destport = PORT_MADAVI;
1103
1107
if (cfg::send2madavi && cfg::ssl_madavi) {
1104
1108
loggerConfigs[LoggerMadavi].destport = 443 ;
1105
- loggerConfigs[LoggerMadavi].session = new BearSSL::Session ;
1109
+ loggerConfigs[LoggerMadavi].session = new_session () ;
1106
1110
}
1107
1111
loggerConfigs[LoggerSensemap].destport = PORT_SENSEMAP;
1108
- loggerConfigs[LoggerSensemap].session = new BearSSL::Session ;
1112
+ loggerConfigs[LoggerSensemap].session = new_session () ;
1109
1113
loggerConfigs[LoggerFSapp].destport = PORT_FSAPP;
1110
- loggerConfigs[LoggerFSapp].session = new BearSSL::Session ;
1114
+ loggerConfigs[LoggerFSapp].session = new_session () ;
1111
1115
loggerConfigs[Loggeraircms].destport = PORT_AIRCMS;
1112
1116
loggerConfigs[LoggerInflux].destport = cfg::port_influx;
1113
1117
if (cfg::send2influx && cfg::ssl_influx) {
1114
- loggerConfigs[LoggerInflux].session = new BearSSL::Session ;
1118
+ loggerConfigs[LoggerInflux].session = new_session () ;
1115
1119
}
1116
1120
loggerConfigs[LoggerCustom].destport = cfg::port_custom;
1117
1121
if (cfg::send2custom && (cfg::ssl_custom || (cfg::port_custom == 443 ))) {
1118
- loggerConfigs[LoggerCustom].session = new BearSSL::Session ;
1122
+ loggerConfigs[LoggerCustom].session = new_session () ;
1119
1123
}
1120
1124
}
1121
1125
@@ -2339,6 +2343,9 @@ static void connectWifi() {
2339
2343
last_signal_strength = WiFi.RSSI ();
2340
2344
}
2341
2345
2346
+ #if defined(ESP8266)
2347
+ BearSSL::X509List x509_dst_root_ca (dst_root_ca_x3);
2348
+
2342
2349
static void configureCACertTrustAnchor (WiFiClientSecure* client) {
2343
2350
constexpr time_t fw_built_year = (__DATE__[ 7 ] - ' 0' ) * 1000 + \
2344
2351
(__DATE__[ 8 ] - ' 0' ) * 100 + \
@@ -2352,12 +2359,14 @@ static void configureCACertTrustAnchor(WiFiClientSecure* client) {
2352
2359
client->setTrustAnchors (&x509_dst_root_ca);
2353
2360
}
2354
2361
}
2362
+ #endif
2355
2363
2356
2364
static WiFiClient* getNewLoggerWiFiClient (const LoggerEntry logger) {
2357
2365
2358
2366
WiFiClient* _client;
2359
2367
if (loggerConfigs[logger].session ) {
2360
2368
_client = new WiFiClientSecure;
2369
+ #if defined(ESP8266)
2361
2370
static_cast <WiFiClientSecure*>(_client)->setSession (loggerConfigs[logger].session );
2362
2371
static_cast <WiFiClientSecure*>(_client)->setBufferSizes (1024 , TCP_MSS > 1024 ? 2048 : 1024 );
2363
2372
switch (logger) {
@@ -2370,6 +2379,7 @@ static WiFiClient* getNewLoggerWiFiClient(const LoggerEntry logger) {
2370
2379
default :
2371
2380
configureCACertTrustAnchor (static_cast <WiFiClientSecure*>(_client));
2372
2381
}
2382
+ #endif
2373
2383
} else {
2374
2384
_client = new WiFiClient;
2375
2385
}
0 commit comments