move transform output initialization from SensESPApp constructor to enable()
@@ -32,24 +32,9 @@ SensESPApp::SensESPApp() {
networking = new Networking("/system/networking", "");
ObservableValue<String>* hostname = networking->get_hostname();
- // setup all devices and their transforms
+ // setup standard devices and their transforms
setup_standard_devices(hostname);
- setup_custom_devices();
-
- // connect all transforms to the Signal K delta output
-
- sk_delta = new SKDelta(hostname->get());
- hostname->attach([hostname, this](){
- this->sk_delta->set_hostname(hostname->get());
- });
- for (auto const& transf : Transform::get_transforms()) {
- if (transf->get_sk_path()!="") {
- transf->attach([transf, this](){
- this->sk_delta->append(transf->as_json());
- });
- }
- }
// create the HTTP server
@@ -112,6 +97,22 @@ void SensESPApp::setup_standard_devices(ObservableValue<String>* hostname) {
void SensESPApp::enable() {
this->led_blinker.set_wifi_disconnected();
+ // connect all transforms to the Signal K delta output
+
+ ObservableValue<String>* hostname = networking->get_hostname();
+
+ sk_delta = new SKDelta(hostname->get());
+ hostname->attach([hostname, this](){
+ this->sk_delta->set_hostname(hostname->get());
+ });
+ for (auto const& transf : Transform::get_transforms()) {
+ if (transf->get_sk_path()!="") {
+ transf->attach([transf, this](){
+ this->sk_delta->append(transf->as_json());
+ });
+ }
+ }
+
debugI("Enabling subsystems");
networking->setup([this](bool connected) {
