Apply code formatter without functional changes

This commit is contained in:
Thomas Basler 2023-07-22 18:00:41 +02:00
parent a06a56a490
commit 658a42db80
14 changed files with 21 additions and 29 deletions

View File

@ -2,11 +2,11 @@
#pragma once #pragma once
#include "WebApi_config.h" #include "WebApi_config.h"
#include "WebApi_device.h"
#include "WebApi_devinfo.h" #include "WebApi_devinfo.h"
#include "WebApi_dtu.h" #include "WebApi_dtu.h"
#include "WebApi_eventlog.h" #include "WebApi_eventlog.h"
#include "WebApi_firmware.h" #include "WebApi_firmware.h"
#include "WebApi_device.h"
#include "WebApi_inverter.h" #include "WebApi_inverter.h"
#include "WebApi_limit.h" #include "WebApi_limit.h"
#include "WebApi_maintenance.h" #include "WebApi_maintenance.h"

View File

@ -1,8 +1,8 @@
// SPDX-License-Identifier: GPL-2.0-or-later // SPDX-License-Identifier: GPL-2.0-or-later
#pragma once #pragma once
#include "HoymilesRadio_NRF.h"
#include "HoymilesRadio_CMT.h" #include "HoymilesRadio_CMT.h"
#include "HoymilesRadio_NRF.h"
#include "inverters/InverterAbstract.h" #include "inverters/InverterAbstract.h"
#include "types.h" #include "types.h"
#include <Print.h> #include <Print.h>

View File

@ -35,11 +35,11 @@ void ActivePowerControlCommand::setActivePowerLimit(float limit, PowerLimitContr
// limit // limit
_payload[12] = (l >> 8) & 0xff; _payload[12] = (l >> 8) & 0xff;
_payload[13] = (l) & 0xff; _payload[13] = (l)&0xff;
// type // type
_payload[14] = (type >> 8) & 0xff; _payload[14] = (type >> 8) & 0xff;
_payload[15] = (type) & 0xff; _payload[15] = (type)&0xff;
udpateCRC(CRC_SIZE); udpateCRC(CRC_SIZE);
} }

View File

@ -6,7 +6,7 @@
#include "../Hoymiles.h" #include "../Hoymiles.h"
#include <cstring> #include <cstring>
const std::array<const AlarmMessage_t, ALARM_MSG_COUNT> AlarmLogParser::_alarmMessages = {{ const std::array<const AlarmMessage_t, ALARM_MSG_COUNT> AlarmLogParser::_alarmMessages = { {
{ AlarmMessageType_t::ALL, 1, "Inverter start" }, { AlarmMessageType_t::ALL, 1, "Inverter start" },
{ AlarmMessageType_t::ALL, 2, "DTU command failed" }, { AlarmMessageType_t::ALL, 2, "DTU command failed" },
{ AlarmMessageType_t::ALL, 73, "Temperature >80°C" }, // https://github.com/tbnobody/OpenDTU/discussions/590#discussioncomment-6049750 { AlarmMessageType_t::ALL, 73, "Temperature >80°C" }, // https://github.com/tbnobody/OpenDTU/discussions/590#discussioncomment-6049750
@ -84,7 +84,7 @@ const std::array<const AlarmMessage_t, ALARM_MSG_COUNT> AlarmLogParser::_alarmMe
{ AlarmMessageType_t::ALL, 5200, "Firmware error" }, { AlarmMessageType_t::ALL, 5200, "Firmware error" },
{ AlarmMessageType_t::ALL, 8310, "Shut down" }, { AlarmMessageType_t::ALL, 8310, "Shut down" },
{ AlarmMessageType_t::ALL, 9000, "Microinverter is suspected of being stolen" }, { AlarmMessageType_t::ALL, 9000, "Microinverter is suspected of being stolen" },
}}; } };
void AlarmLogParser::clearBuffer() void AlarmLogParser::clearBuffer()
{ {

View File

@ -2,8 +2,8 @@
#pragma once #pragma once
#include "Parser.h" #include "Parser.h"
#include <Arduino.h> #include <Arduino.h>
#include <cstdint>
#include <array> #include <array>
#include <cstdint>
#define ALARM_LOG_ENTRY_COUNT 15 #define ALARM_LOG_ENTRY_COUNT 15
#define ALARM_LOG_ENTRY_SIZE 12 #define ALARM_LOG_ENTRY_SIZE 12

View File

@ -300,7 +300,7 @@ void ConfigurationClass::migrate()
config.Mqtt_PublishInterval = mqtt["publish_invterval"]; config.Mqtt_PublishInterval = mqtt["publish_invterval"];
} }
if (config.Cfg_Version < 0x00011900) { if (config.Cfg_Version < 0x00011900) {
JsonObject dtu = doc["dtu"]; JsonObject dtu = doc["dtu"];
config.Dtu_NrfPaLevel = dtu["pa_level"]; config.Dtu_NrfPaLevel = dtu["pa_level"];
} }

View File

@ -15,7 +15,7 @@
// for all generations, this is equivalent to SPI3_HOST in the lower level driver // for all generations, this is equivalent to SPI3_HOST in the lower level driver
// For ESP32-C2, the only externally usable HW SPI controller is SPI2, its signal names // For ESP32-C2, the only externally usable HW SPI controller is SPI2, its signal names
// being prefixed with FSPI. // being prefixed with FSPI.
#if CONFIG_IDF_TARGET_ESP32S2 || CONFIG_IDF_TARGET_ESP32S3 #if CONFIG_IDF_TARGET_ESP32S2 || CONFIG_IDF_TARGET_ESP32S3
#define SPI_NRF HSPI #define SPI_NRF HSPI
#elif CONFIG_IDF_TARGET_ESP32C3 #elif CONFIG_IDF_TARGET_ESP32C3
#define SPI_NRF FSPI #define SPI_NRF FSPI

View File

@ -3,8 +3,8 @@
* Copyright (C) 2022 Thomas Basler and others * Copyright (C) 2022 Thomas Basler and others
*/ */
#include "MqttSettings.h" #include "MqttSettings.h"
#include "MessageOutput.h"
#include "Configuration.h" #include "Configuration.h"
#include "MessageOutput.h"
MqttSettingsClass::MqttSettingsClass() MqttSettingsClass::MqttSettingsClass()
{ {

View File

@ -159,8 +159,7 @@ void NetworkSettingsClass::loop()
setStaticIp(); setStaticIp();
setHostname(); setHostname();
} }
} else } else if (_networkMode != network_mode::WiFi) {
if (_networkMode != network_mode::WiFi) {
// Do stuff when switching to Ethernet mode // Do stuff when switching to Ethernet mode
MessageOutput.println("Switch to WiFi mode"); MessageOutput.println("Switch to WiFi mode");
_networkMode = network_mode::WiFi; _networkMode = network_mode::WiFi;
@ -249,8 +248,7 @@ void NetworkSettingsClass::setHostname()
WiFi.mode(WIFI_MODE_APSTA); WiFi.mode(WIFI_MODE_APSTA);
WiFi.mode(WIFI_MODE_STA); WiFi.mode(WIFI_MODE_STA);
setupMode(); setupMode();
} } else if (_networkMode == network_mode::Ethernet) {
else if (_networkMode == network_mode::Ethernet) {
if (ETH.setHostname(getHostname().c_str())) { if (ETH.setHostname(getHostname().c_str())) {
MessageOutput.println("done"); MessageOutput.println("done");
} else { } else {
@ -276,8 +274,7 @@ void NetworkSettingsClass::setStaticIp()
IPAddress(Configuration.get().WiFi_Dns2)); IPAddress(Configuration.get().WiFi_Dns2));
MessageOutput.println("done"); MessageOutput.println("done");
} }
} } else if (_networkMode == network_mode::Ethernet) {
else if (_networkMode == network_mode::Ethernet) {
if (Configuration.get().WiFi_Dhcp) { if (Configuration.get().WiFi_Dhcp) {
MessageOutput.print("Configuring Ethernet DHCP IP... "); MessageOutput.print("Configuring Ethernet DHCP IP... ");
ETH.config(INADDR_NONE, INADDR_NONE, INADDR_NONE, INADDR_NONE); ETH.config(INADDR_NONE, INADDR_NONE, INADDR_NONE, INADDR_NONE);

View File

@ -443,7 +443,7 @@ void WebApiInverterClass::onInverterOrder(AsyncWebServerRequest* request)
// The order array contains list or id in the right order // The order array contains list or id in the right order
JsonArray orderArray = root["order"].as<JsonArray>(); JsonArray orderArray = root["order"].as<JsonArray>();
uint8_t order = 0; uint8_t order = 0;
for(JsonVariant id : orderArray) { for (JsonVariant id : orderArray) {
uint8_t inverter_id = id.as<uint8_t>(); uint8_t inverter_id = id.as<uint8_t>();
if (inverter_id < INV_MAX_COUNT) { if (inverter_id < INV_MAX_COUNT) {
INVERTER_CONFIG_T& inverter = Configuration.get().Inverter[inverter_id]; INVERTER_CONFIG_T& inverter = Configuration.get().Inverter[inverter_id];

View File

@ -221,8 +221,8 @@ void WebApiMqttClass::onMqttAdminPost(AsyncWebServerRequest* request)
} }
if (root["mqtt_root_ca_cert"].as<String>().length() > MQTT_MAX_CERT_STRLEN if (root["mqtt_root_ca_cert"].as<String>().length() > MQTT_MAX_CERT_STRLEN
|| root["mqtt_client_cert"].as<String>().length() > MQTT_MAX_CERT_STRLEN || root["mqtt_client_cert"].as<String>().length() > MQTT_MAX_CERT_STRLEN
|| root["mqtt_client_key"].as<String>().length() > MQTT_MAX_CERT_STRLEN) { || root["mqtt_client_key"].as<String>().length() > MQTT_MAX_CERT_STRLEN) {
retMsg["message"] = "Certificates must not be longer than " STR(MQTT_MAX_CERT_STRLEN) " characters!"; retMsg["message"] = "Certificates must not be longer than " STR(MQTT_MAX_CERT_STRLEN) " characters!";
retMsg["code"] = WebApiError::MqttCertificateLength; retMsg["code"] = WebApiError::MqttCertificateLength;
retMsg["param"]["max"] = MQTT_MAX_CERT_STRLEN; retMsg["param"]["max"] = MQTT_MAX_CERT_STRLEN;

View File

@ -143,8 +143,7 @@ void WebApiPrometheusClass::addPanelInfo(AsyncResponseStream* stream, String& se
idx, idx,
inv->name(), inv->name(),
channel, channel,
config.Inverter[idx].channel[channel].Name config.Inverter[idx].channel[channel].Name);
);
if (printHelp) { if (printHelp) {
stream->print("# HELP opendtu_MaxPower panel maximum output power\n"); stream->print("# HELP opendtu_MaxPower panel maximum output power\n");
@ -155,8 +154,7 @@ void WebApiPrometheusClass::addPanelInfo(AsyncResponseStream* stream, String& se
idx, idx,
inv->name(), inv->name(),
channel, channel,
config.Inverter[idx].channel[channel].MaxChannelPower config.Inverter[idx].channel[channel].MaxChannelPower);
);
if (printHelp) { if (printHelp) {
stream->print("# HELP opendtu_YieldTotalOffset panel yield offset (for used inverters)\n"); stream->print("# HELP opendtu_YieldTotalOffset panel yield offset (for used inverters)\n");
@ -167,6 +165,5 @@ void WebApiPrometheusClass::addPanelInfo(AsyncResponseStream* stream, String& se
idx, idx,
inv->name(), inv->name(),
channel, channel,
config.Inverter[idx].channel[channel].YieldTotalOffset config.Inverter[idx].channel[channel].YieldTotalOffset);
);
} }

View File

@ -58,7 +58,7 @@ void WebApiWebappClass::init(AsyncWebServer* server)
#ifdef AUTO_GIT_HASH #ifdef AUTO_GIT_HASH
// check client If-None-Match header vs ETag/AUTO_GIT_HASH // check client If-None-Match header vs ETag/AUTO_GIT_HASH
bool eTagMatch = false; bool eTagMatch = false;
if(request->hasHeader("If-None-Match")){ if (request->hasHeader("If-None-Match")) {
AsyncWebHeader* h = request->getHeader("If-None-Match"); AsyncWebHeader* h = request->getHeader("If-None-Match");
if (strncmp(AUTO_GIT_HASH, h->value().c_str(), strlen(AUTO_GIT_HASH)) == 0) { if (strncmp(AUTO_GIT_HASH, h->value().c_str(), strlen(AUTO_GIT_HASH)) == 0) {
eTagMatch = true; eTagMatch = true;

View File

@ -169,9 +169,7 @@ void WebApiWsLiveClass::generateJsonResponse(JsonVariant& root)
JsonObject hintObj = root.createNestedObject("hints"); JsonObject hintObj = root.createNestedObject("hints");
struct tm timeinfo; struct tm timeinfo;
hintObj["time_sync"] = !getLocalTime(&timeinfo, 5); hintObj["time_sync"] = !getLocalTime(&timeinfo, 5);
hintObj["radio_problem"] = hintObj["radio_problem"] = (Hoymiles.getRadioNrf()->isInitialized() && (!Hoymiles.getRadioNrf()->isConnected() || !Hoymiles.getRadioNrf()->isPVariant())) || (Hoymiles.getRadioCmt()->isInitialized() && (!Hoymiles.getRadioCmt()->isConnected()));
(Hoymiles.getRadioNrf()->isInitialized() && (!Hoymiles.getRadioNrf()->isConnected() || !Hoymiles.getRadioNrf()->isPVariant())) ||
(Hoymiles.getRadioCmt()->isInitialized() && (!Hoymiles.getRadioCmt()->isConnected()));
if (!strcmp(Configuration.get().Security_Password, ACCESS_POINT_PASSWORD)) { if (!strcmp(Configuration.get().Security_Password, ACCESS_POINT_PASSWORD)) {
hintObj["default_password"] = true; hintObj["default_password"] = true;
} else { } else {