Skip to content

Commit

Permalink
Sync with local development
Browse files Browse the repository at this point in the history
  • Loading branch information
vanvught committed Dec 27, 2023
1 parent c664ba1 commit f2d5c8e
Show file tree
Hide file tree
Showing 24 changed files with 106 additions and 206 deletions.
3 changes: 1 addition & 2 deletions gd32_emac_artnet_pixel_dmx_multi/firmware/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,7 @@ void main() {
DisplayUdf display;
ConfigStore configStore;
display.TextStatus(NetworkConst::MSG_NETWORK_INIT, Display7SegmentMessage::INFO_NETWORK_INIT, CONSOLE_YELLOW);
StoreNetwork storeNetwork;
Network nw(&storeNetwork);
Network nw;
MDNS mDns;
display.TextStatus(NetworkConst::MSG_NETWORK_STARTED, Display7SegmentMessage::INFO_NONE, CONSOLE_GREEN);
FirmwareVersion fw(SOFTWARE_VERSION, __DATE__, __TIME__);
Expand Down
2 changes: 1 addition & 1 deletion gd32_emac_artnet_pixel_dmx_multi/lib/factorydefaults.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ namespace responder {
void factorydefaults() {
RemoteConfig::Get()->SetDisable(false);
ConfigStore::Get()->ResetSetList(configstore::Store::RDMDEVICE);
StoreNetwork::Get()->SaveDhcp(true);
StoreNetwork::SaveDhcp(true);
}

} // namespace responder
Expand Down
3 changes: 1 addition & 2 deletions gd32_emac_artnet_pixel_multi/firmware/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,7 @@ void main() {
DisplayUdf display;
ConfigStore configStore;
display.TextStatus(NetworkConst::MSG_NETWORK_INIT, Display7SegmentMessage::INFO_NETWORK_INIT, CONSOLE_YELLOW);
StoreNetwork storeNetwork;
Network nw(&storeNetwork);
Network nw;
MDNS mDns;
display.TextStatus(NetworkConst::MSG_NETWORK_STARTED, Display7SegmentMessage::INFO_NONE, CONSOLE_GREEN);
FirmwareVersion fw(SOFTWARE_VERSION, __DATE__, __TIME__);
Expand Down
2 changes: 1 addition & 1 deletion gd32_emac_artnet_pixel_multi/lib/factorydefaults.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ namespace responder {
void factorydefaults() {
RemoteConfig::Get()->SetDisable(false);
ConfigStore::Get()->ResetSetList(configstore::Store::RDMDEVICE);
StoreNetwork::Get()->SaveDhcp(true);
StoreNetwork::SaveDhcp(true);
}

} // namespace responder
Expand Down
3 changes: 1 addition & 2 deletions gd32_emac_ddp_pixel_dmx_multi/firmware/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,7 @@ void main() {
DisplayUdf display;
ConfigStore configStore;
display.TextStatus(NetworkConst::MSG_NETWORK_INIT, Display7SegmentMessage::INFO_NETWORK_INIT, CONSOLE_YELLOW);
StoreNetwork storeNetwork;
Network nw(&storeNetwork);
Network nw;
display.TextStatus(NetworkConst::MSG_NETWORK_STARTED, Display7SegmentMessage::INFO_NONE, CONSOLE_GREEN);
FirmwareVersion fw(SOFTWARE_VERSION, __DATE__, __TIME__);

Expand Down
2 changes: 1 addition & 1 deletion gd32_emac_ddp_pixel_dmx_multi/lib/factorydefaults.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ namespace responder {
void factorydefaults() {
RemoteConfig::Get()->SetDisable(false);
ConfigStore::Get()->ResetSetList(configstore::Store::RDMDEVICE);
StoreNetwork::Get()->SaveDhcp(true);
StoreNetwork::SaveDhcp(true);
}

} // namespace responder
Expand Down
3 changes: 1 addition & 2 deletions gd32_emac_ddp_pixel_multi/firmware/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,7 @@ void main() {
DisplayUdf display;
ConfigStore configStore;
display.TextStatus(NetworkConst::MSG_NETWORK_INIT, Display7SegmentMessage::INFO_NETWORK_INIT, CONSOLE_YELLOW);
StoreNetwork storeNetwork;
Network nw(&storeNetwork);
Network nw;
display.TextStatus(NetworkConst::MSG_NETWORK_STARTED, Display7SegmentMessage::INFO_NONE, CONSOLE_GREEN);
FirmwareVersion fw(SOFTWARE_VERSION, __DATE__, __TIME__);

Expand Down
2 changes: 1 addition & 1 deletion gd32_emac_ddp_pixel_multi/lib/factorydefaults.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ namespace responder {
void factorydefaults() {
RemoteConfig::Get()->SetDisable(false);
ConfigStore::Get()->ResetSetList(configstore::Store::RDMDEVICE);
StoreNetwork::Get()->SaveDhcp(true);
StoreNetwork::SaveDhcp(true);
}

} // namespace responder
Expand Down
3 changes: 1 addition & 2 deletions gd32_emac_debug/firmware/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,7 @@ void main() {
DisplayUdf display;
ConfigStore configStore;
display.TextStatus(NetworkConst::MSG_NETWORK_INIT, Display7SegmentMessage::INFO_NETWORK_INIT, CONSOLE_YELLOW);
StoreNetwork storeNetwork;
Network nw(&storeNetwork);
Network nw;
MDNS mDns;
display.TextStatus(NetworkConst::MSG_NETWORK_STARTED, Display7SegmentMessage::INFO_NONE, CONSOLE_GREEN);
FirmwareVersion fw(SOFTWARE_VERSION, __DATE__, __TIME__);
Expand Down
7 changes: 2 additions & 5 deletions gd32_emac_e131_pixel_dmx_multi/firmware/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,7 @@ void main() {
DisplayUdf display;
ConfigStore configStore;
display.TextStatus(NetworkConst::MSG_NETWORK_INIT, Display7SegmentMessage::INFO_NETWORK_INIT, CONSOLE_YELLOW);
StoreNetwork storeNetwork;
Network nw(&storeNetwork);
Network nw;
MDNS mDns;
display.TextStatus(NetworkConst::MSG_NETWORK_STARTED, Display7SegmentMessage::INFO_NONE, CONSOLE_GREEN);
FirmwareVersion fw(SOFTWARE_VERSION, __DATE__, __TIME__);
Expand All @@ -112,11 +111,9 @@ void main() {

display.TextStatus(E131MsgConst::PARAMS, Display7SegmentMessage::INFO_BRIDGE_PARMAMS, CONSOLE_YELLOW);

StoreE131 storeE131;
E131Params e131params(&storeE131);

E131Bridge bridge;

E131Params e131params;
e131params.Load();
e131params.Set(DMXPORT_OFFSET);

Expand Down
2 changes: 1 addition & 1 deletion gd32_emac_e131_pixel_dmx_multi/lib/factorydefaults.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ namespace responder {
void factorydefaults() {
RemoteConfig::Get()->SetDisable(false);
ConfigStore::Get()->ResetSetList(configstore::Store::RDMDEVICE);
StoreNetwork::Get()->SaveDhcp(true);
StoreNetwork::SaveDhcp(true);
}

} // namespace responder
Expand Down
7 changes: 2 additions & 5 deletions gd32_emac_e131_pixel_multi/firmware/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,7 @@ void main() {
DisplayUdf display;
ConfigStore configStore;
display.TextStatus(NetworkConst::MSG_NETWORK_INIT, Display7SegmentMessage::INFO_NETWORK_INIT, CONSOLE_YELLOW);
StoreNetwork storeNetwork;
Network nw(&storeNetwork);
Network nw;
MDNS mDns;
display.TextStatus(NetworkConst::MSG_NETWORK_STARTED, Display7SegmentMessage::INFO_NONE, CONSOLE_GREEN);
FirmwareVersion fw(SOFTWARE_VERSION, __DATE__, __TIME__);
Expand All @@ -104,11 +103,9 @@ void main() {

display.TextStatus(E131MsgConst::PARAMS, Display7SegmentMessage::INFO_BRIDGE_PARMAMS, CONSOLE_YELLOW);

StoreE131 storeE131;
E131Params e131params(&storeE131);

E131Bridge bridge;

E131Params e131params;
e131params.Load();
e131params.Set(DMXPORT_OFFSET);

Expand Down
2 changes: 1 addition & 1 deletion gd32_emac_e131_pixel_multi/lib/factorydefaults.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ namespace responder {
void factorydefaults() {
RemoteConfig::Get()->SetDisable(false);
ConfigStore::Get()->ResetSetList(configstore::Store::RDMDEVICE);
StoreNetwork::Get()->SaveDhcp(true);
StoreNetwork::SaveDhcp(true);
}

} // namespace responder
Expand Down
41 changes: 0 additions & 41 deletions lib-configstore/src/e131/storee131.cpp

This file was deleted.

41 changes: 0 additions & 41 deletions lib-configstore/src/storenetwork.cpp

This file was deleted.

11 changes: 1 addition & 10 deletions lib-e131/include/e131params.h
Original file line number Diff line number Diff line change
Expand Up @@ -110,17 +110,9 @@ struct Mask {
};
}

class E131ParamsStore {
public:
virtual ~E131ParamsStore() = default;

virtual void Update(const e131params::Params *pParams)=0;
virtual void Copy(e131params::Params *pParams)=0;
};

class E131Params {
public:
E131Params(E131ParamsStore *pE131ParamsStore);
E131Params();

bool Load();
void Load(const char *pBuffer, uint32_t nLength);
Expand Down Expand Up @@ -183,7 +175,6 @@ class E131Params {
}

private:
E131ParamsStore *m_pE131ParamsStore;
e131params::Params m_Params;
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,24 +29,29 @@
#include "e131params.h"
#include "configstore.h"

class StoreE131 final: public E131ParamsStore {
class StoreE131 {
public:
StoreE131();

void Update(const struct e131params::Params *pParams) override {
ConfigStore::Get()->Update(configstore::Store::NODE, pParams, sizeof(struct e131params::Params));
static StoreE131& Get() {
static StoreE131 instance;
return instance;
}

void Copy(struct e131params::Params *pParams) override {
ConfigStore::Get()->Copy(configstore::Store::NODE, pParams, sizeof(struct e131params::Params));
static void Update(const struct e131params::Params *pParams) {
Get().IUpdate(pParams);
}

static StoreE131* Get() {
return s_pThis;
static void Copy(struct e131params::Params *pParams) {
Get().ICopy(pParams);
}

private:
static StoreE131 *s_pThis;
void IUpdate(const struct e131params::Params *pParams) {
ConfigStore::Get()->Update(configstore::Store::NODE, pParams, sizeof(struct e131params::Params));
}

void ICopy(struct e131params::Params *pParams) {
ConfigStore::Get()->Copy(configstore::Store::NODE, pParams, sizeof(struct e131params::Params));
}
};

#endif /* STOREE131_H_ */
13 changes: 6 additions & 7 deletions lib-e131/src/node/e131params.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
#include "e131params.h"
#include "e131paramsconst.h"
#include "e131.h"
#include "storee131.h"

#include "readconfigfile.h"
#include "sscan.h"
Expand All @@ -62,7 +63,7 @@ static constexpr uint16_t portdir_clear(const uint32_t i) {

using namespace e131params;

E131Params::E131Params(E131ParamsStore *pE131ParamsStore):m_pE131ParamsStore(pE131ParamsStore) {
E131Params::E131Params() {
DEBUG_ENTRY
DEBUG_PRINTF("sizeof(struct Params)=%d", static_cast<int>(sizeof(struct Params)));

Expand Down Expand Up @@ -92,10 +93,10 @@ bool E131Params::Load() {
ReadConfigFile configfile(E131Params::staticCallbackFunction, this);

if (configfile.Read(E131ParamsConst::FILE_NAME)) {
m_pE131ParamsStore->Update(&m_Params);
StoreE131::Update(&m_Params);
} else
#endif
m_pE131ParamsStore->Copy(&m_Params);
StoreE131::Copy(&m_Params);

#ifndef NDEBUG
Dump();
Expand All @@ -116,8 +117,7 @@ void E131Params::Load(const char* pBuffer, uint32_t nLength) {

config.Read(pBuffer, nLength);

assert(m_pE131ParamsStore != nullptr);
m_pE131ParamsStore->Update(&m_Params);
StoreE131::Update(&m_Params);

#ifndef NDEBUG
Dump();
Expand Down Expand Up @@ -252,8 +252,7 @@ void E131Params::Builder(const struct Params *pParams, char *pBuffer, uint32_t n
if (pParams != nullptr) {
memcpy(&m_Params, pParams, sizeof(struct Params));
} else {
assert(m_pE131ParamsStore != nullptr);
m_pE131ParamsStore->Copy(&m_Params);
StoreE131::Copy(&m_Params);
}

PropertiesBuilder builder(E131ParamsConst::FILE_NAME, pBuffer, nLength);
Expand Down
4 changes: 1 addition & 3 deletions lib-network/include/emac/network.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@

class Network {
public:
Network(NetworkParamsStore *pNetworkParamsStore);
Network();
~Network() = default;

void Print();
Expand Down Expand Up @@ -275,8 +275,6 @@ class Network {
uint8_t m_aNetMacaddr[network::MAC_SIZE];
char m_aIfName[IFNAMSIZ];

NetworkStore *m_pNetworkStore { nullptr };

struct QueuedConfig {
static constexpr uint32_t NONE = 0;
static constexpr uint32_t STATIC_IP = (1U << 0);
Expand Down
Loading

0 comments on commit f2d5c8e

Please sign in to comment.