Enhance DALI device type discovery and query handling
- Introduce DaliDeviceTypeDiscovery struct for managing device type queries. - Implement discoverDeviceTypes method in DaliBase for improved device type detection. - Update DaliComm to handle query responses more robustly, including handling multiple device replies. - Add setDetectedDeviceTypes method in DaliDevice to manage detected device types and capabilities.
This commit is contained in:
@@ -11,6 +11,7 @@
|
||||
// - Send: [0x10, addr, cmd]
|
||||
// - Ext: [0x11, addr, cmd] (sent twice with a small delay)
|
||||
// - Query: [0x12, addr, cmd] -> expects [0xFF, data] on success
|
||||
// COMPARE may also return [0xFD, data] when multiple devices reply together
|
||||
// Callers provide UART callbacks; this class only builds frames and parses basic responses.
|
||||
class DaliComm {
|
||||
public:
|
||||
@@ -50,7 +51,8 @@ class DaliComm {
|
||||
bool sendCmd(uint8_t addr, uint8_t cmd) const;
|
||||
// Send extended command frame (0x11).
|
||||
bool sendExtCmd(uint8_t addr, uint8_t cmd) const;
|
||||
// Send query frame (0x12) and parse single-byte response. Returns nullopt on no/invalid response.
|
||||
// Send query frame (0x12) and parse single-byte response. Returns nullopt on no/invalid response,
|
||||
// except COMPARE where 0xFD collisions are treated as a positive match.
|
||||
std::optional<uint8_t> queryCmd(uint8_t addr, uint8_t cmd) const;
|
||||
|
||||
// Helpers to mirror Dart address conversion (DEC short address -> DALI odd/even encoded).
|
||||
@@ -63,6 +65,7 @@ class DaliComm {
|
||||
TransactCallback transact_;
|
||||
DelayCallback delay_;
|
||||
|
||||
void prepareForQuery() const;
|
||||
bool writeFrame(const std::vector<uint8_t>& frame) const;
|
||||
void sleepMs(uint32_t ms) const;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user