diff --git a/code/ESP32/.vscode/settings.json b/code/ESP32/.vscode/settings.json new file mode 100644 index 0000000..a1dc2ea --- /dev/null +++ b/code/ESP32/.vscode/settings.json @@ -0,0 +1,5 @@ +{ + "files.associations": { + "typeinfo": "cpp" + } +} \ No newline at end of file diff --git a/code/ESP32/include/LinearActuatorNoPot.h b/code/ESP32/include/LinearActuatorNoPot.h index be3215a..9e2d02a 100644 --- a/code/ESP32/include/LinearActuatorNoPot.h +++ b/code/ESP32/include/LinearActuatorNoPot.h @@ -3,6 +3,7 @@ #include #include #include "Enumerations.h" +#include "IOT.h" #define noise 2 #define histeresis 2 @@ -10,6 +11,8 @@ #define longCheckInterval 5000 #define POSITIONINTERVAL 5 // Move array when sun moves 5 degrees past current position +extern SkyeTracker::IOT _iot; + namespace SkyeTracker { diff --git a/code/ESP32/src/IOT.cpp b/code/ESP32/src/IOT.cpp index 077258b..819c9ad 100644 --- a/code/ESP32/src/IOT.cpp +++ b/code/ESP32/src/IOT.cpp @@ -21,7 +21,7 @@ char _mqttServer[IOTWEBCONF_WORD_LEN]; char _mqttPort[5]; char _mqttUserName[IOTWEBCONF_WORD_LEN]; char _mqttUserPassword[IOTWEBCONF_WORD_LEN]; -u_int _uniqueId = 0; +u_int32_t _uniqueId = ESP.getEfuseMac() & 0xFFFFFFFF; IotWebConfSeparator seperatorParam = IotWebConfSeparator("MQTT"); IotWebConfParameter mqttServerParam = IotWebConfParameter("MQTT server", "mqttServer", _mqttServer, IOTWEBCONF_WORD_LEN); IotWebConfParameter mqttPortParam = IotWebConfParameter("MQTT port", "mqttSPort", _mqttPort, 5, "text", NULL, "1883"); diff --git a/code/ESP32/src/LinearActuatorNoPot.cpp b/code/ESP32/src/LinearActuatorNoPot.cpp index 80d6ef8..3ab6ff8 100644 --- a/code/ESP32/src/LinearActuatorNoPot.cpp +++ b/code/ESP32/src/LinearActuatorNoPot.cpp @@ -187,6 +187,11 @@ namespace SkyeTracker setInterval(shortCheckInterval); _requestedAngle = angle; enabled = true; + char angle[16]; + sprintf(angle, "%.0f", _requestedAngle); + char subtopic[32]; + sprintf(subtopic, "%sAngle", _name); + _iot.publish(subtopic, angle, false); } } diff --git a/code/ESP32/src/Tracker.cpp b/code/ESP32/src/Tracker.cpp index 92e39e0..3ad5ff4 100644 --- a/code/ESP32/src/Tracker.cpp +++ b/code/ESP32/src/Tracker.cpp @@ -169,6 +169,7 @@ namespace SkyeTracker void Tracker::setState(TrackerState state) { + logd("setState: %d", state); if (_trackerState != state) { _trackerState = state; _config.SendConfiguration();