Skip to content

Commit

Permalink
chore(framework): Upgrade platformio to 6.7.0 (ESP-IDF 5.2.1) (#160)
Browse files Browse the repository at this point in the history
  • Loading branch information
Slider0007 authored Jun 2, 2024
1 parent 49f1397 commit 49e123e
Show file tree
Hide file tree
Showing 12 changed files with 30 additions and 98 deletions.
2 changes: 1 addition & 1 deletion code/components/jomjol_fileserver_ota/server_file.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -573,7 +573,7 @@ static esp_err_t download_get_handler(httpd_req_t *req)
/* Get value of expected key from query string */
if (httpd_query_key_value(buf, "readonly", param, sizeof(param)) == ESP_OK) {
ESP_LOGI(TAG, "Found URL query parameter => readonly=%s", param);
readonly = param && strcmp(param,"true")==0;
readonly = (strcmp(param, "true") == 0);
}
}
}
Expand Down
6 changes: 0 additions & 6 deletions code/components/jomjol_flowcontroll/ClassFlow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,12 +109,6 @@ std::string ClassFlow::getHTMLSingleStep(std::string host)
}


std::string ClassFlow::getReadout()
{
return std::string();
}


std::string ClassFlow::GetParameterName(std::string _input)
{
std::string _param;
Expand Down
1 change: 0 additions & 1 deletion code/components/jomjol_flowcontroll/ClassFlow.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ class ClassFlow
virtual bool ReadParameter(FILE* pfile, std::string &aktparamgraph);
virtual bool doFlow(std::string time);
virtual std::string getHTMLSingleStep(std::string host);
virtual std::string getReadout();

virtual std::string name() {return "ClassFlow";};
};
Expand Down
17 changes: 1 addition & 16 deletions code/components/jomjol_flowcontroll/ClassFlowControll.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1058,22 +1058,7 @@ std::string ClassFlowControll::getReadout(bool _rawvalue = false, bool _noerror
if (flowpostprocessing)
return flowpostprocessing->getReadoutParam(_rawvalue, _noerror, _number);

std::string zw = "";
std::string result = "";

for (int i = 0; i < FlowControll.size(); ++i)
{
zw = FlowControll[i]->getReadout();
if (zw.length() > 0)
{
if (result.length() == 0)
result = zw;
else
result = result + "\t" + zw;
}
}

return result;
return std::string("");
}


Expand Down
1 change: 1 addition & 0 deletions code/components/jomjol_helper/sdcard_check.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include <stdio.h>
#include <stdbool.h>
#include <stdint.h>
#include <unistd.h>
#include <inttypes.h>
#include <sys/stat.h>

Expand Down
9 changes: 1 addition & 8 deletions code/components/jomjol_helper/system.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -147,14 +147,7 @@ bool setCPUFrequency(void)
{
ConfigFile configFile = ConfigFile(CONFIG_FILE);
std::string cpuFrequency = "160";

#ifdef CONFIG_IDF_TARGET_ESP32
esp_pm_config_esp32_t pm_config;
#elif defined(CONFIG_IDF_TARGET_ESP32S3)
esp_pm_config_esp32s3_t pm_config;
#else
#error "esp_pm_config_* not defined"
#endif
esp_pm_config_t pm_config;

if (!configFile.ConfigFileExists()){
LogFile.WriteToFile(ESP_LOG_WARN, TAG, "No config file - exit setCpuFrequency");
Expand Down
2 changes: 1 addition & 1 deletion code/components/jomjol_time_sntp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ FILE(GLOB_RECURSE app_sources ${CMAKE_CURRENT_SOURCE_DIR}/*.*)

idf_component_register(SRCS ${app_sources}
INCLUDE_DIRS "."
REQUIRES jomjol_logfile jomjol_configfile)
REQUIRES esp_netif jomjol_logfile jomjol_configfile)


52 changes: 18 additions & 34 deletions code/components/jomjol_time_sntp/time_sntp.cpp
Original file line number Diff line number Diff line change
@@ -1,19 +1,9 @@
#include "time_sntp.h"
#include "../../include/defines.h"

#include <string>
#include <time.h>
#include <sys/time.h>

#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "freertos/event_groups.h"

#include "esp_system.h"
#include "esp_log.h"
#include "esp_attr.h"
#include "esp_sleep.h"
#include "esp_sntp.h"
#include "esp_netif_sntp.h"

#include "ClassLogFile.h"
#include "configFile.h"
Expand Down Expand Up @@ -145,25 +135,25 @@ bool getTimeWasSetOnce(void)

std::string getServerName(void)
{
char buf[100];
char buf[128];

if (sntp_getservername(0)){
snprintf(buf, sizeof(buf), "%s", sntp_getservername(0));
if (esp_sntp_getservername(0)){
snprintf(buf, sizeof(buf), "%s", esp_sntp_getservername(0));
return std::string(buf);
}
else { // we have either IPv4 or IPv6 address
ip_addr_t const *ip = sntp_getserver(0);
else { // Use IPv4 or IPv6 address instead
ip_addr_t const *ip = esp_sntp_getserver(0);
if (ipaddr_ntoa_r(ip, buf, sizeof(buf)) != NULL) {
return std::string(buf);
}
}
return "";
return "Unknown SNTP server";
}


/**
* Load the Time zone and Time server from the config file and initialize the NTP client
* The RTC keeps the time after a restart (Except on Power On or Pin Reset)
* Load the time zone and time server from the config file and initialize the NTP client
* The RTC keeps the time after a restart (except on Power On or Pin Reset)
* There should only be a minor correction through NTP
*/
bool setupTime()
Expand Down Expand Up @@ -235,10 +225,9 @@ bool setupTime()

if (useNtp) {
LogFile.WriteToFile(ESP_LOG_INFO, TAG, "Init NTP service");
sntp_setoperatingmode(SNTP_OPMODE_POLL);
sntp_setservername(0, timeServer.c_str());
sntp_set_time_sync_notification_cb(timeSyncNotificationCallback);
sntp_init();
esp_sntp_config_t sntpConfig = ESP_NETIF_SNTP_DEFAULT_CONFIG(timeServer.c_str());
sntpConfig.sync_cb = timeSyncNotificationCallback;
esp_netif_sntp_init(&sntpConfig);

// Wait for time sync to ensure start with proper time
if (!waitingForTimeSync() || !getTimeIsSet()) {
Expand Down Expand Up @@ -298,7 +287,7 @@ void setupTimeServer(std::string _timeServer)
if (_timeServer == "") {
LogFile.WriteToFile(ESP_LOG_INFO, TAG, "NTP service disabled");
useNtp = false;
sntp_stop();
esp_netif_sntp_deinit();
}
else {
LogFile.WriteToFile(ESP_LOG_INFO, TAG, "Time server: " + _timeServer);
Expand All @@ -308,18 +297,13 @@ void setupTimeServer(std::string _timeServer)
timeServer = _timeServer;

if (useNtp) {
sntp_setoperatingmode(SNTP_OPMODE_POLL);
sntp_setservername(0, timeServer.c_str());
sntp_set_time_sync_notification_cb(timeSyncNotificationCallback);
setTimeZone(timeZone);

LogFile.WriteToFile(ESP_LOG_INFO, TAG, "Init NTP service");
if (!sntp_enabled()) {
setTimeZone(timeZone);
sntp_init();
}
else {
sntp_restart();
}
esp_netif_sntp_deinit();
esp_sntp_config_t sntpConfig = ESP_NETIF_SNTP_DEFAULT_CONFIG(timeServer.c_str());
sntpConfig.sync_cb = timeSyncNotificationCallback;
esp_netif_sntp_init(&sntpConfig);

// Wait for time sync to ensure start with proper time
if (!waitingForTimeSync() || !getTimeIsSet()) {
Expand Down
13 changes: 1 addition & 12 deletions code/components/jomjol_time_sntp/time_sntp.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,7 @@
#define TIMESNTP_H

#include <string>
#include <time.h>
#include <sys/time.h>

#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "freertos/event_groups.h"

#include "esp_system.h"
#include "esp_log.h"
#include "esp_attr.h"
#include "esp_sleep.h"
#include "esp_sntp.h"
#include <ctime>


std::string getCurrentTimeString(const char * frm);
Expand Down
7 changes: 5 additions & 2 deletions code/components/jomjol_wlan/connect_wlan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -484,8 +484,11 @@ static void event_handler(void* arg, esp_event_base_t event_base, int32_t event_
}
else {
WIFIConnected = false;
if (disconn->reason == WIFI_REASON_NO_AP_FOUND) {
LogFile.WriteToFile(ESP_LOG_WARN, TAG, "Disconnected (" + std::to_string(disconn->reason) + ", No AP)");
if (disconn->reason == WIFI_REASON_NO_AP_FOUND ||
disconn->reason == WIFI_REASON_NO_AP_FOUND_W_COMPATIBLE_SECURITY ||
disconn->reason == WIFI_REASON_NO_AP_FOUND_IN_AUTHMODE_THRESHOLD ||
disconn->reason == WIFI_REASON_NO_AP_FOUND_IN_RSSI_THRESHOLD) {
LogFile.WriteToFile(ESP_LOG_WARN, TAG, "Disconnected (" + std::to_string(disconn->reason) + ", No AP found)");
StatusLED(WLAN_CONN, 1, false);
}
else if (disconn->reason == WIFI_REASON_AUTH_EXPIRE ||
Expand Down
16 changes: 0 additions & 16 deletions code/dependencies.lock

This file was deleted.

2 changes: 1 addition & 1 deletion code/platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ lib_deps =

[common:esp32-idf]
extends = common:idf
platform = platformio/espressif32 @ 6.3.2
platform = platformio/espressif32 @ 6.7.0
framework = espidf
lib_deps =
${common:idf.lib_deps}
Expand Down

0 comments on commit 49e123e

Please sign in to comment.