Merge pull request #6494 from s-hadinger/minor_fixes

Minor fixes to Hue Emulation and Light
This commit is contained in:
Theo Arends 2019-09-25 22:43:15 +02:00 committed by GitHub
commit 130117cd44
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 6 deletions

View File

@ -2281,7 +2281,7 @@ void CmndChannel(void)
light_controller.changeChannels(Light.current_color);
coldim = true;
}
ResponseCmndIdxNumber(Light.current_color[XdrvMailbox.index -1] * 100 / 255);
ResponseCmndIdxNumber(changeUIntScale(Light.current_color[XdrvMailbox.index -1],0,255,0,100));
if (coldim) {
LightPreparePower();
}

View File

@ -364,12 +364,15 @@ void HueLightStatus2(uint8_t device, String *response)
char fname[33];
strcpy(fname, Settings.friendlyname[MAX_FRIENDLYNAMES-1]);
uint32_t fname_len = strlen(fname);
if (fname_len >= 33-3) {
fname[33-3] = 0x00;
fname_len = 33-3;
}
if (fname_len > 30) { fname_len = 30; }
fname[fname_len++] = '-';
fname[fname_len++] = '0' + device - MAX_FRIENDLYNAMES;
if (device - MAX_FRIENDLYNAMES < 10) {
fname[fname_len++] = '0' + device - MAX_FRIENDLYNAMES;
} else {
fname[fname_len++] = 'A' + device - MAX_FRIENDLYNAMES - 10;
}
fname[fname_len] = 0x00;
response->replace("{j1", fname);
}
response->replace("{j2", GetHueDeviceId(device));