From 6cefbf6e62db74eadc34712c62279dd376977b51 Mon Sep 17 00:00:00 2001 From: Cristian Fluture Date: Sun, 14 Jan 2018 23:38:21 -0800 Subject: [PATCH] Added 3 endpoints (UUID_0, UUID_1, UUID2) to expose the device UUID --- Firmware/MotorControl/commands.cpp | 3 +++ Firmware/MotorControl/protocol.hpp | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/Firmware/MotorControl/commands.cpp b/Firmware/MotorControl/commands.cpp index bc426507..25871230 100644 --- a/Firmware/MotorControl/commands.cpp +++ b/Firmware/MotorControl/commands.cpp @@ -94,6 +94,9 @@ void motors_1_set_current_setpoint_func(void) { const Endpoint endpoints[] = { Endpoint::make_property("vbus_voltage", const_cast(&vbus_voltage)), Endpoint::make_property("elec_rad_per_enc", const_cast(&elec_rad_per_enc)), + Endpoint::make_property("UUID_0", (const uint32_t*)(ID_UNIQUE_ADDRESS + 0*4)), + Endpoint::make_property("UUID_1", (const uint32_t*)(ID_UNIQUE_ADDRESS + 1*4)), + Endpoint::make_property("UUID_2", (const uint32_t*)(ID_UNIQUE_ADDRESS + 2*4)), Endpoint::make_object("motor0"), Endpoint::make_property("control_mode", reinterpret_cast(&motors[0].control_mode)), Endpoint::make_property("error", reinterpret_cast(&motors[0].error)), diff --git a/Firmware/MotorControl/protocol.hpp b/Firmware/MotorControl/protocol.hpp index 92664d55..bc3b3b9a 100644 --- a/Firmware/MotorControl/protocol.hpp +++ b/Firmware/MotorControl/protocol.hpp @@ -335,6 +335,10 @@ inline const char* get_default_json_modifier() { return "\"type\":\"int32\",\"access\":\"rw\""; } template<> +inline const char* get_default_json_modifier() { + return "\"type\":\"uint32\",\"access\":\"r\""; +} +template<> inline const char* get_default_json_modifier() { return "\"type\":\"uint16\",\"access\":\"r\""; }