KNX: Command KNXTX_VALx now supports value with decimals

This commit is contained in:
Adrian Scillato 2018-06-28 12:52:05 -03:00 committed by GitHub
parent 3e96e04690
commit 50d504fb7b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 11 additions and 7 deletions

View File

@ -1045,14 +1045,18 @@ boolean KnxCommand()
byte i = KNX_GA_Search(index + KNX_SLOT1 -1); byte i = KNX_GA_Search(index + KNX_SLOT1 -1);
while ( i != KNX_Empty ) { while ( i != KNX_Empty ) {
KNX_addr.value = Settings.knx_GA_addr[i]; KNX_addr.value = Settings.knx_GA_addr[i];
knx.write_2byte_float(KNX_addr, XdrvMailbox.payload);
float tempvar = CharToDouble(XdrvMailbox.data);
dtostrfd(tempvar,2,XdrvMailbox.data);
knx.write_2byte_float(KNX_addr, tempvar);
if (Settings.flag.knx_enable_enhancement) { if (Settings.flag.knx_enable_enhancement) {
knx.write_2byte_float(KNX_addr, XdrvMailbox.payload); knx.write_2byte_float(KNX_addr, tempvar);
knx.write_2byte_float(KNX_addr, XdrvMailbox.payload); knx.write_2byte_float(KNX_addr, tempvar);
} }
snprintf_P(log_data, sizeof(log_data), PSTR(D_LOG_KNX "%s = %d " D_SENT_TO " %d.%d.%d"), snprintf_P(log_data, sizeof(log_data), PSTR(D_LOG_KNX "%s = %s " D_SENT_TO " %d.%d.%d"),
device_param_ga[index + KNX_SLOT1 -2], XdrvMailbox.payload, device_param_ga[index + KNX_SLOT1 -2], XdrvMailbox.data,
KNX_addr.ga.area, KNX_addr.ga.line, KNX_addr.ga.member); KNX_addr.ga.area, KNX_addr.ga.line, KNX_addr.ga.member);
AddLog(LOG_LEVEL_INFO); AddLog(LOG_LEVEL_INFO);
@ -1062,8 +1066,8 @@ boolean KnxCommand()
else { return false; } // Incomplete command else { return false; } // Incomplete command
snprintf_P (mqtt_data, sizeof(mqtt_data), PSTR("{\"%s%d\":\"%d\"}"), snprintf_P (mqtt_data, sizeof(mqtt_data), PSTR("{\"%s%d\":\"%s\"}"),
command, index, XdrvMailbox.payload ); command, index, XdrvMailbox.data );
return true; return true;
} }