Skip to content

Commit

Permalink
Change order of includes to detect missing includes earlier
Browse files Browse the repository at this point in the history
  • Loading branch information
cziter15 committed Feb 9, 2025
1 parent a102239 commit 468c812
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 21 deletions.
15 changes: 7 additions & 8 deletions src/ksIotFrameworkLib.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,6 @@

#pragma once

#include "ksf/ksApplication.h"
#include "ksf/misc/ksSimpleTimer.h"
#include "ksf/ksComponent.h"
#include "ksf/misc/ksConfig.h"
#include "ksf/ksConstants.h"
#include "ksf/evt/ksEvent.h"
#include "ksf/comp/ksConfigProvider.h"
#include "ksf/comp/ksLed.h"
#include "ksf/comp/ksResetButton.h"
Expand All @@ -24,5 +18,10 @@
#include "ksf/comp/ksWifiConnector.h"
#include "ksf/comp/ksDevicePortal.h"
#include "ksf/comp/ksDevStatMqttReporter.h"

#include "ksf/ksAppRotator.h"
#include "ksf/ksAppRotator.h"
#include "ksf/ksApplication.h"
#include "ksf/ksComponent.h"
#include "ksf/evt/ksEvent.h"
#include "ksf/misc/ksConfig.h"
#include "ksf/misc/ksSimpleTimer.h"
#include "ksf/ksConstants.h"
2 changes: 2 additions & 0 deletions src/ksf/comp/ksConfigProvider.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@

#pragma once

#include <string>
#include <utility>
#include <list>

#include "../ksComponent.h"

namespace ksf::misc
Expand Down
1 change: 1 addition & 0 deletions src/ksf/comp/ksLed.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

#pragma once

#include <inttypes.h>
#include "../ksComponent.h"

namespace ksf::comps
Expand Down
1 change: 1 addition & 0 deletions src/ksf/comp/ksMqttConnector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ namespace ksf::comps
ksMqttConnector::~ksMqttConnector() = default;

ksMqttConnector::ksMqttConnector(bool sendConnectionStatus, bool usePersistentSession)
: reconnectTimer(KSF_MQTT_RECONNECT_DELAY_MS)
{
bitflags.sendConnectionStatus = sendConnectionStatus;
bitflags.usePersistentSession = usePersistentSession;
Expand Down
6 changes: 2 additions & 4 deletions src/ksf/comp/ksMqttConnector.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,11 @@ namespace ksf::comps
ksApplication* app{nullptr}; //!< Application pointer.
#endif

misc::ksDomainQuery domainResolver; //!< Domain query used to resolve MQTT broker address.
misc::ksDomainQuery domainResolver; //!< Domain query used to resolve MQTT broker address.
std::unique_ptr<ksMqttConnectorNetClient_t> netClientUq; //!< Shared pointer to WiFiClient used to connect to MQTT.
std::unique_ptr<PubSubClient> mqttClientUq; //!< Shared pointer to PubSubClient used to connect to MQTT.

std::weak_ptr<ksWifiConnector> wifiConnWp; //!< Weak pointer to WiFi connector.
misc::ksSimpleTimer reconnectTimer; //!< Timer that counts time between reconnection attempts.

uint64_t lastSuccessConnectionTime{0}; //!< Time of connection to MQTT broker in seconds.
uint32_t reconnectCounter{0}; //!< MQTT reconnection counter.
Expand All @@ -68,8 +68,6 @@ namespace ksf::comps
bool wasConnected : 1; //!< True if connected in previous loop.
} bitflags = {true, false, true};

misc::ksSimpleTimer reconnectTimer{KSF_MQTT_RECONNECT_DELAY_MS}; //!< Timer that counts time between reconnection attempts.

std::string login; //!< Saved MQTT login.
std::string password; //!< Saved MQTT password.
std::string prefix; //!< Saved MQTT prefix.
Expand Down
3 changes: 2 additions & 1 deletion src/ksf/comp/ksWifiConnector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@

namespace ksf::comps
{
ksWifiConnector::ksWifiConnector(const char* hostname, bool savePower)
ksWifiConnector::ksWifiConnector(const char* hostname, bool savePower)
: wifiTimeoutTimer{KSF_WIFI_TIMEOUT_MS}, wifiReconnectTimer{KSF_WIFI_RECONNECT_TIME_MS}, wifiIpCheckTimer{KSF_ONE_SEC_MS}
{
bitflags.savePower = savePower;
#if defined(ESP32)
Expand Down
16 changes: 8 additions & 8 deletions src/ksf/comp/ksWifiConnector.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,15 @@ namespace ksf::comps
KSF_RTTI_DECLARATIONS(ksWifiConnector, ksComponent)

protected:
misc::ksSimpleTimer wifiTimeoutTimer{KSF_WIFI_TIMEOUT_MS}; //!< Wifi timer - long timeout in case of issues.
misc::ksSimpleTimer wifiReconnectTimer{KSF_WIFI_RECONNECT_TIME_MS}; //!< Wifi timer - reconnection timeout.
misc::ksSimpleTimer wifiIpCheckTimer{KSF_ONE_SEC_MS}; //!< Wifi timer - IP check interval.
misc::ksSimpleTimer wifiTimeoutTimer; //!< Wifi timer - long timeout in case of issues.
misc::ksSimpleTimer wifiReconnectTimer; //!< Wifi timer - reconnection timeout.
misc::ksSimpleTimer wifiIpCheckTimer; //!< Wifi timer - IP check interval.

struct
{
bool wasConnected : 1; //!< True if connected in previous loop.
bool savePower : 1; //!< True to save power.
bool gotIpAddress : 1; //!< True if IP address is set.
bool wasConnected : 1; //!< True if connected in previous loop.
bool savePower : 1; //!< True to save power.
bool gotIpAddress : 1; //!< True if IP address is set.
} bitflags = {false, true, false};

/*!
Expand All @@ -51,8 +51,8 @@ namespace ksf::comps
void setupMacAddress();

public:
DECLARE_KS_EVENT(onConnected) // onConnected event that user can bind to.
DECLARE_KS_EVENT(onDisconnected) // onDisconnected event that user can bind to.
DECLARE_KS_EVENT(onConnected) // onConnected event that user can bind to.
DECLARE_KS_EVENT(onDisconnected) // onDisconnected event that user can bind to.

/*!
@brief Constructs WiFi connector component.
Expand Down

0 comments on commit 468c812

Please sign in to comment.