Add files via upload

This commit is contained in:
logon84 2021-12-06 13:50:47 +01:00 committed by GitHub
parent 3f1e5746a1
commit 90add2b4c2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 28 additions and 25 deletions

View File

@ -145,7 +145,6 @@ struct miel_hvac_msg_update {
#define MIEL_HVAC_UPDATE_F_TEMP (1 << 10) #define MIEL_HVAC_UPDATE_F_TEMP (1 << 10)
#define MIEL_HVAC_UPDATE_F_FAN (1 << 11) #define MIEL_HVAC_UPDATE_F_FAN (1 << 11)
#define MIEL_HVAC_UPDATE_F_VANE (1 << 12) #define MIEL_HVAC_UPDATE_F_VANE (1 << 12)
#define MIEL_HVAC_UPDATE_F_TEMP05 (1 << 19)
uint8_t power; uint8_t power;
#define MIEL_HVAC_UPDATE_POWER_OFF 0x00 #define MIEL_HVAC_UPDATE_POWER_OFF 0x00
#define MIEL_HVAC_UPDATE_POWER_ON 0x01 #define MIEL_HVAC_UPDATE_POWER_ON 0x01
@ -204,31 +203,34 @@ CTASSERT(offsetof(struct miel_hvac_msg_update, temp05) == MIEL_HVAC_OFFS(19));
static inline uint8_t static inline uint8_t
miel_hvac_deg2temp(uint8_t deg) miel_hvac_deg2temp(uint8_t deg)
{ {
#ifndef MIEL_HVAC_ENHANCED_RES if (!Settings->flag5.mqtt_info_retain) {
return (31 - deg); return (31 - deg);
#else }
return 2*deg + 128; else {
#endif return 2*deg + 128;
}
} }
static inline uint8_t static inline uint8_t
miel_hvac_temp2deg(uint8_t temp) miel_hvac_temp2deg(uint8_t temp)
{ {
#ifndef MIEL_HVAC_ENHANCED_RES if (!Settings->flag5.mqtt_info_retain) {
return (31 - temp); return (31 - temp);
#else }
return ((float)(((temp - 128))/2)); else {
#endif return ((float)(((temp - 128))/2));
}
} }
static inline unsigned int static inline unsigned int
miel_hvac_roomtemp2deg(uint8_t roomtemp) miel_hvac_roomtemp2deg(uint8_t roomtemp)
{ {
#ifndef MIEL_HVAC_ENHANCED_RES if (!Settings->flag5.mqtt_info_retain) {
return ((unsigned int)roomtemp + 10); return ((unsigned int)roomtemp + 10);
#else }
return ((float)(roomtemp - 128)/2;) else {
#endif return ((float)((roomtemp - 128)/2));
}
} }
struct miel_hvac_msg_remotetemp { struct miel_hvac_msg_remotetemp {
@ -713,13 +715,16 @@ miel_hvac_cmnd_settemp(void)
miel_hvac_respond_unsupported(); miel_hvac_respond_unsupported();
return; return;
} }
#ifndef MIEL_HVAC_ENHANCED_RES update->flags |= htons(MIEL_HVAC_UPDATE_F_TEMP);
update->flags |= htons(MIEL_HVAC_UPDATE_F_TEMP); if (!Settings->flag5.mqtt_info_retain) {
update->temp = miel_hvac_deg2temp(degc); update->temp = miel_hvac_deg2temp(degc);
#else update->temp05 = 0;
update->flags |= htons(MIEL_HVAC_UPDATE_F_TEMP05); }
else {
update->temp = 0;
update->temp05 = miel_hvac_deg2temp(degc); update->temp05 = miel_hvac_deg2temp(degc);
#endif }
ResponseCmndNumber(degc); ResponseCmndNumber(degc);
} }
@ -895,12 +900,11 @@ miel_hvac_publish_settings(struct miel_hvac_softc *sc)
ResponseAppend_P(PSTR(",\"HA" D_JSON_IRHVAC_MODE "\":\"%s\""), ResponseAppend_P(PSTR(",\"HA" D_JSON_IRHVAC_MODE "\":\"%s\""),
set->power ? name : "off"); set->power ? name : "off");
} }
if (set->temp05 == 0) { if (!Settings->flag5.mqtt_info_retain) {
dtostrfd(ConvertTemp(miel_hvac_temp2deg(set->temp)), dtostrfd(ConvertTemp(miel_hvac_temp2deg(set->temp)),
Settings->flag2.temperature_resolution, temp); Settings->flag2.temperature_resolution, temp);
} }
else { else {
#define MIEL_HVAC_ENHANCED_RES 1
dtostrfd(ConvertTemp(miel_hvac_temp2deg(set->temp05)), dtostrfd(ConvertTemp(miel_hvac_temp2deg(set->temp05)),
Settings->flag2.temperature_resolution, temp); Settings->flag2.temperature_resolution, temp);
} }
@ -1105,13 +1109,12 @@ miel_hvac_sensor(struct miel_hvac_softc *sc)
const struct miel_hvac_data_roomtemp *rt = const struct miel_hvac_data_roomtemp *rt =
&sc->sc_temp.data.roomtemp; &sc->sc_temp.data.roomtemp;
char room_temp[33]; char room_temp[33];
if(rt->temp05 == 0) { if(!Settings->flag5.mqtt_info_retain) {
unsigned int temp = miel_hvac_roomtemp2deg(rt->temp); unsigned int temp = miel_hvac_roomtemp2deg(rt->temp);
dtostrfd(ConvertTemp(temp), dtostrfd(ConvertTemp(temp),
Settings->flag2.temperature_resolution, room_temp); Settings->flag2.temperature_resolution, room_temp);
} }
else { else {
#define MIEL_HVAC_ENHANCED_RES 1
float temp = miel_hvac_roomtemp2deg(rt->temp05); float temp = miel_hvac_roomtemp2deg(rt->temp05);
dtostrfd(ConvertTemp(temp), dtostrfd(ConvertTemp(temp),
Settings->flag2.temperature_resolution, room_temp); Settings->flag2.temperature_resolution, room_temp);