Skip to content

Commit

Permalink
Apply code formatter without functional changes
Browse files Browse the repository at this point in the history
  • Loading branch information
tbnobody committed Jul 22, 2023
1 parent a06a56a commit 658a42d
Show file tree
Hide file tree
Showing 14 changed files with 21 additions and 29 deletions.
2 changes: 1 addition & 1 deletion include/WebApi.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
#pragma once

#include "WebApi_config.h"
#include "WebApi_device.h"
#include "WebApi_devinfo.h"
#include "WebApi_dtu.h"
#include "WebApi_eventlog.h"
#include "WebApi_firmware.h"
#include "WebApi_device.h"
#include "WebApi_inverter.h"
#include "WebApi_limit.h"
#include "WebApi_maintenance.h"
Expand Down
2 changes: 1 addition & 1 deletion lib/Hoymiles/src/Hoymiles.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// SPDX-License-Identifier: GPL-2.0-or-later
#pragma once

#include "HoymilesRadio_NRF.h"
#include "HoymilesRadio_CMT.h"
#include "HoymilesRadio_NRF.h"
#include "inverters/InverterAbstract.h"
#include "types.h"
#include <Print.h>
Expand Down
4 changes: 2 additions & 2 deletions lib/Hoymiles/src/commands/ActivePowerControlCommand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@ void ActivePowerControlCommand::setActivePowerLimit(float limit, PowerLimitContr

// limit
_payload[12] = (l >> 8) & 0xff;
_payload[13] = (l) & 0xff;
_payload[13] = (l)&0xff;

// type
_payload[14] = (type >> 8) & 0xff;
_payload[15] = (type) & 0xff;
_payload[15] = (type)&0xff;

udpateCRC(CRC_SIZE);
}
Expand Down
4 changes: 2 additions & 2 deletions lib/Hoymiles/src/parser/AlarmLogParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#include "../Hoymiles.h"
#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, 2, "DTU command failed" },
{ AlarmMessageType_t::ALL, 73, "Temperature >80°C" }, // https://github.com/tbnobody/OpenDTU/discussions/590#discussioncomment-6049750
Expand Down Expand Up @@ -84,7 +84,7 @@ const std::array<const AlarmMessage_t, ALARM_MSG_COUNT> AlarmLogParser::_alarmMe
{ AlarmMessageType_t::ALL, 5200, "Firmware error" },
{ AlarmMessageType_t::ALL, 8310, "Shut down" },
{ AlarmMessageType_t::ALL, 9000, "Microinverter is suspected of being stolen" },
}};
} };

void AlarmLogParser::clearBuffer()
{
Expand Down
2 changes: 1 addition & 1 deletion lib/Hoymiles/src/parser/AlarmLogParser.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
#pragma once
#include "Parser.h"
#include <Arduino.h>
#include <cstdint>
#include <array>
#include <cstdint>

#define ALARM_LOG_ENTRY_COUNT 15
#define ALARM_LOG_ENTRY_SIZE 12
Expand Down
2 changes: 1 addition & 1 deletion src/Configuration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ void ConfigurationClass::migrate()
config.Mqtt_PublishInterval = mqtt["publish_invterval"];
}

if (config.Cfg_Version < 0x00011900) {
if (config.Cfg_Version < 0x00011900) {
JsonObject dtu = doc["dtu"];
config.Dtu_NrfPaLevel = dtu["pa_level"];
}
Expand Down
2 changes: 1 addition & 1 deletion src/InverterSettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
// 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
// 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
#elif CONFIG_IDF_TARGET_ESP32C3
#define SPI_NRF FSPI
Expand Down
2 changes: 1 addition & 1 deletion src/MqttSettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
* Copyright (C) 2022 Thomas Basler and others
*/
#include "MqttSettings.h"
#include "MessageOutput.h"
#include "Configuration.h"
#include "MessageOutput.h"

MqttSettingsClass::MqttSettingsClass()
{
Expand Down
9 changes: 3 additions & 6 deletions src/NetworkSettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,7 @@ void NetworkSettingsClass::loop()
setStaticIp();
setHostname();
}
} else
if (_networkMode != network_mode::WiFi) {
} else if (_networkMode != network_mode::WiFi) {
// Do stuff when switching to Ethernet mode
MessageOutput.println("Switch to WiFi mode");
_networkMode = network_mode::WiFi;
Expand Down Expand Up @@ -249,8 +248,7 @@ void NetworkSettingsClass::setHostname()
WiFi.mode(WIFI_MODE_APSTA);
WiFi.mode(WIFI_MODE_STA);
setupMode();
}
else if (_networkMode == network_mode::Ethernet) {
} else if (_networkMode == network_mode::Ethernet) {
if (ETH.setHostname(getHostname().c_str())) {
MessageOutput.println("done");
} else {
Expand All @@ -276,8 +274,7 @@ void NetworkSettingsClass::setStaticIp()
IPAddress(Configuration.get().WiFi_Dns2));
MessageOutput.println("done");
}
}
else if (_networkMode == network_mode::Ethernet) {
} else if (_networkMode == network_mode::Ethernet) {
if (Configuration.get().WiFi_Dhcp) {
MessageOutput.print("Configuring Ethernet DHCP IP... ");
ETH.config(INADDR_NONE, INADDR_NONE, INADDR_NONE, INADDR_NONE);
Expand Down
2 changes: 1 addition & 1 deletion src/WebApi_inverter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,7 @@ void WebApiInverterClass::onInverterOrder(AsyncWebServerRequest* request)
// The order array contains list or id in the right order
JsonArray orderArray = root["order"].as<JsonArray>();
uint8_t order = 0;
for(JsonVariant id : orderArray) {
for (JsonVariant id : orderArray) {
uint8_t inverter_id = id.as<uint8_t>();
if (inverter_id < INV_MAX_COUNT) {
INVERTER_CONFIG_T& inverter = Configuration.get().Inverter[inverter_id];
Expand Down
4 changes: 2 additions & 2 deletions src/WebApi_mqtt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -221,8 +221,8 @@ void WebApiMqttClass::onMqttAdminPost(AsyncWebServerRequest* request)
}

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_key"].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) {
retMsg["message"] = "Certificates must not be longer than " STR(MQTT_MAX_CERT_STRLEN) " characters!";
retMsg["code"] = WebApiError::MqttCertificateLength;
retMsg["param"]["max"] = MQTT_MAX_CERT_STRLEN;
Expand Down
9 changes: 3 additions & 6 deletions src/WebApi_prometheus.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,7 @@ void WebApiPrometheusClass::addPanelInfo(AsyncResponseStream* stream, String& se
idx,
inv->name(),
channel,
config.Inverter[idx].channel[channel].Name
);
config.Inverter[idx].channel[channel].Name);

if (printHelp) {
stream->print("# HELP opendtu_MaxPower panel maximum output power\n");
Expand All @@ -155,8 +154,7 @@ void WebApiPrometheusClass::addPanelInfo(AsyncResponseStream* stream, String& se
idx,
inv->name(),
channel,
config.Inverter[idx].channel[channel].MaxChannelPower
);
config.Inverter[idx].channel[channel].MaxChannelPower);

if (printHelp) {
stream->print("# HELP opendtu_YieldTotalOffset panel yield offset (for used inverters)\n");
Expand All @@ -167,6 +165,5 @@ void WebApiPrometheusClass::addPanelInfo(AsyncResponseStream* stream, String& se
idx,
inv->name(),
channel,
config.Inverter[idx].channel[channel].YieldTotalOffset
);
config.Inverter[idx].channel[channel].YieldTotalOffset);
}
2 changes: 1 addition & 1 deletion src/WebApi_webapp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ void WebApiWebappClass::init(AsyncWebServer* server)
#ifdef AUTO_GIT_HASH
// check client If-None-Match header vs ETag/AUTO_GIT_HASH
bool eTagMatch = false;
if(request->hasHeader("If-None-Match")){
if (request->hasHeader("If-None-Match")) {
AsyncWebHeader* h = request->getHeader("If-None-Match");
if (strncmp(AUTO_GIT_HASH, h->value().c_str(), strlen(AUTO_GIT_HASH)) == 0) {
eTagMatch = true;
Expand Down
4 changes: 1 addition & 3 deletions src/WebApi_ws_live.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -169,9 +169,7 @@ void WebApiWsLiveClass::generateJsonResponse(JsonVariant& root)
JsonObject hintObj = root.createNestedObject("hints");
struct tm timeinfo;
hintObj["time_sync"] = !getLocalTime(&timeinfo, 5);
hintObj["radio_problem"] =
(Hoymiles.getRadioNrf()->isInitialized() && (!Hoymiles.getRadioNrf()->isConnected() || !Hoymiles.getRadioNrf()->isPVariant())) ||
(Hoymiles.getRadioCmt()->isInitialized() && (!Hoymiles.getRadioCmt()->isConnected()));
hintObj["radio_problem"] = (Hoymiles.getRadioNrf()->isInitialized() && (!Hoymiles.getRadioNrf()->isConnected() || !Hoymiles.getRadioNrf()->isPVariant())) || (Hoymiles.getRadioCmt()->isInitialized() && (!Hoymiles.getRadioCmt()->isConnected()));
if (!strcmp(Configuration.get().Security_Password, ACCESS_POINT_PASSWORD)) {
hintObj["default_password"] = true;
} else {
Expand Down

0 comments on commit 658a42d

Please sign in to comment.