mirror of https://github.com/arendst/Tasmota.git
Bugfixes
removed some errors in RESULT message. Wrong values Limit tilt duration time to 127 steps (6.35sec) and avoid negative numbers
This commit is contained in:
parent
5680bc9cef
commit
e501994919
|
@ -126,6 +126,7 @@ struct SHUTTERGLOBAL {
|
||||||
|
|
||||||
#define SHT_DIV_ROUND(__A, __B) (((__A) + (__B)/2) / (__B))
|
#define SHT_DIV_ROUND(__A, __B) (((__A) + (__B)/2) / (__B))
|
||||||
|
|
||||||
|
|
||||||
void ShutterLogPos(uint32_t i)
|
void ShutterLogPos(uint32_t i)
|
||||||
{
|
{
|
||||||
char stemp2[10];
|
char stemp2[10];
|
||||||
|
@ -1242,7 +1243,7 @@ void CmndShutterPosition(void)
|
||||||
ShutterReportPosition(true, index);
|
ShutterReportPosition(true, index);
|
||||||
}
|
}
|
||||||
XdrvMailbox.index = index +1; // Fix random index for ShutterClose
|
XdrvMailbox.index = index +1; // Fix random index for ShutterClose
|
||||||
if (XdrvMailbox.command)
|
strcpy( XdrvMailbox.command , D_CMND_SHUTTER_POSITION);
|
||||||
ResponseCmndIdxNumber((Settings->shutter_options[index] & 1) ? 100 - target_pos_percent : target_pos_percent);
|
ResponseCmndIdxNumber((Settings->shutter_options[index] & 1) ? 100 - target_pos_percent : target_pos_percent);
|
||||||
} else {
|
} else {
|
||||||
ShutterReportPosition(true, MAX_SHUTTERS);
|
ShutterReportPosition(true, MAX_SHUTTERS);
|
||||||
|
@ -1632,7 +1633,6 @@ void CmndShutterSetTilt(void)
|
||||||
}
|
}
|
||||||
XdrvMailbox.data[0] = '\0';
|
XdrvMailbox.data[0] = '\0';
|
||||||
AddLog(LOG_LEVEL_INFO, PSTR("SHT: TiltTarget %d, payload %d"), Shutter[XdrvMailbox.index -1].tilt_target_pos,XdrvMailbox.payload);
|
AddLog(LOG_LEVEL_INFO, PSTR("SHT: TiltTarget %d, payload %d"), Shutter[XdrvMailbox.index -1].tilt_target_pos,XdrvMailbox.payload);
|
||||||
ResponseCmndNumber(Shutter[XdrvMailbox.index -1].tilt_target_pos);
|
|
||||||
Shutter[XdrvMailbox.index -1].tiltmoving = 1;
|
Shutter[XdrvMailbox.index -1].tiltmoving = 1;
|
||||||
CmndShutterPosition();
|
CmndShutterPosition();
|
||||||
}
|
}
|
||||||
|
@ -1649,13 +1649,13 @@ void CmndShutterTiltConfig(void)
|
||||||
for (char *str = strtok_r(data_copy, " ", &str_ptr); str && i < 6; str = strtok_r(nullptr, " ", &str_ptr), i++) {
|
for (char *str = strtok_r(data_copy, " ", &str_ptr); str && i < 6; str = strtok_r(nullptr, " ", &str_ptr), i++) {
|
||||||
Shutter[XdrvMailbox.index -1].tilt_config[i] = Settings->shutter_tilt_config[i][XdrvMailbox.index -1] = atoi(str);
|
Shutter[XdrvMailbox.index -1].tilt_config[i] = Settings->shutter_tilt_config[i][XdrvMailbox.index -1] = atoi(str);
|
||||||
}
|
}
|
||||||
|
// avoid negative runtime
|
||||||
|
Settings->shutter_tilt_config[2][XdrvMailbox.index -1] = Shutter[XdrvMailbox.index -1].tilt_config[2] = Shutter[XdrvMailbox.index -1].tilt_config[2] >= 0 ? Shutter[XdrvMailbox.index -1].tilt_config[2] : 127;
|
||||||
ShutterInit();
|
ShutterInit();
|
||||||
ResponseCmndIdxChar(XdrvMailbox.data);
|
|
||||||
} else {
|
|
||||||
char setting_chr[30] = "0";
|
|
||||||
snprintf_P(setting_chr, sizeof(setting_chr), PSTR("%d %d %d %d %d"), Shutter[XdrvMailbox.index -1].tilt_config[0], Shutter[XdrvMailbox.index -1].tilt_config[1],Shutter[XdrvMailbox.index -1].tilt_config[2],Shutter[XdrvMailbox.index -1].tilt_config[3],Shutter[XdrvMailbox.index -1].tilt_config[4]);
|
|
||||||
ResponseCmndIdxChar(setting_chr);
|
|
||||||
}
|
}
|
||||||
|
char setting_chr[30] = "0";
|
||||||
|
snprintf_P(setting_chr, sizeof(setting_chr), PSTR("%d %d %d %d %d"), XdrvMailbox.index -1,Shutter[XdrvMailbox.index -1].tilt_config[0], Shutter[XdrvMailbox.index -1].tilt_config[1],Shutter[XdrvMailbox.index -1].tilt_config[2],Shutter[XdrvMailbox.index -1].tilt_config[3],Shutter[XdrvMailbox.index -1].tilt_config[4]);
|
||||||
|
ResponseCmndIdxChar(setting_chr);
|
||||||
AddLog(LOG_LEVEL_INFO, PSTR("SHT: TiltConfig %d, min: %d, max %d, runtime %d, close_pos: %d, open_pos: %d"), XdrvMailbox.index ,Shutter[XdrvMailbox.index -1].tilt_config[0], Shutter[XdrvMailbox.index -1].tilt_config[1],Shutter[XdrvMailbox.index -1].tilt_config[2],Shutter[XdrvMailbox.index -1].tilt_config[3],Shutter[XdrvMailbox.index -1].tilt_config[4]);
|
AddLog(LOG_LEVEL_INFO, PSTR("SHT: TiltConfig %d, min: %d, max %d, runtime %d, close_pos: %d, open_pos: %d"), XdrvMailbox.index ,Shutter[XdrvMailbox.index -1].tilt_config[0], Shutter[XdrvMailbox.index -1].tilt_config[1],Shutter[XdrvMailbox.index -1].tilt_config[2],Shutter[XdrvMailbox.index -1].tilt_config[3],Shutter[XdrvMailbox.index -1].tilt_config[4]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1663,13 +1663,12 @@ void CmndShutterTiltConfig(void)
|
||||||
void CmndShutterTiltIncDec(void)
|
void CmndShutterTiltIncDec(void)
|
||||||
{
|
{
|
||||||
//AddLog(LOG_LEVEL_DEBUG_MORE, PSTR("SHT: Change in: payload %s (%d), payload %d, idx %d, src %d"), XdrvMailbox.data , XdrvMailbox.data_len, XdrvMailbox.payload , XdrvMailbox.index, TasmotaGlobal.last_source );
|
//AddLog(LOG_LEVEL_DEBUG_MORE, PSTR("SHT: Change in: payload %s (%d), payload %d, idx %d, src %d"), XdrvMailbox.data , XdrvMailbox.data_len, XdrvMailbox.payload , XdrvMailbox.index, TasmotaGlobal.last_source );
|
||||||
if ((XdrvMailbox.index > 0) && (XdrvMailbox.index <= TasmotaGlobal.shutters_present)) {
|
if ((XdrvMailbox.index > 0) && (XdrvMailbox.index <= TasmotaGlobal.shutters_present) && XdrvMailbox.data_len > 0) {
|
||||||
if (XdrvMailbox.data_len > 0) {
|
|
||||||
XdrvMailbox.payload = Shutter[XdrvMailbox.index -1].tilt_target_pos+XdrvMailbox.payload;
|
XdrvMailbox.payload = Shutter[XdrvMailbox.index -1].tilt_target_pos+XdrvMailbox.payload;
|
||||||
CmndShutterSetTilt();
|
CmndShutterSetTilt();
|
||||||
|
} else {
|
||||||
|
ResponseCmndIdxNumber(XdrvMailbox.payload);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
ResponseCmndNumber(Shutter[XdrvMailbox.index -1].tilt_target_pos);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*********************************************************************************************\
|
/*********************************************************************************************\
|
||||||
|
|
Loading…
Reference in New Issue