Fix scripter hue compilation error

This commit is contained in:
Theo Arends 2021-02-17 11:32:21 +01:00
parent a59b6b2720
commit bfa5c63fff
1 changed files with 4 additions and 6 deletions

View File

@ -603,11 +603,10 @@ void HueLightStatus2(uint8_t device, String *response)
// last 24 bits of Mac address + 4 bits of local light + high bit for relays 16-31, relay 32 is mapped to 0
// Zigbee extension: bit 29 = 1, and last 16 bits = short address of Zigbee device
#ifndef USE_ZIGBEE
uint32_t EncodeLightId(uint8_t relay_id)
uint32_t EncodeLightId(uint8_t relay_id) {
#else
uint32_t EncodeLightId(uint8_t relay_id, uint16_t z_shortaddr = 0)
uint32_t EncodeLightId(uint8_t relay_id, uint16_t z_shortaddr = 0) {
#endif
{
uint8_t mac[6];
WiFi.macAddress(mac);
uint32_t id = (mac[3] << 20) | (mac[4] << 12) | (mac[5] << 4);
@ -636,11 +635,10 @@ uint32_t EncodeLightId(uint8_t relay_id, uint16_t z_shortaddr = 0)
// If the Id encodes a Zigbee device (meaning bit 29 is set)
// it returns 0 and sets the 'shortaddr' to the device short address
#ifndef USE_ZIGBEE
uint32_t DecodeLightId(uint32_t hue_id)
uint32_t DecodeLightId(uint32_t hue_id) {
#else
uint32_t DecodeLightId(uint32_t hue_id, uint16_t * shortaddr = nullptr)
uint32_t DecodeLightId(uint32_t hue_id, uint16_t * shortaddr = nullptr) {
#endif
{
uint8_t relay_id = hue_id & 0xF;
if (hue_id & (1 << 28)) { // check if bit 25 is set, if so we have
relay_id += 16;