mirror of
https://github.com/arendst/Tasmota.git
synced 2025-07-28 21:26:33 +00:00
Merge pull request #7405 from to-scho/hotfix/shutter_calibration_command_add_response
Add response to ShutterCalibration command
This commit is contained in:
commit
8e3540d58d
@ -731,20 +731,24 @@ void CmndShutterCalibration(void) // ????
|
|||||||
// Loop through the version string, splitting on '.' seperators.
|
// Loop through the version string, splitting on '.' seperators.
|
||||||
for (char *str = strtok_r(version_dup, " ", &str_ptr); str && i < 5; str = strtok_r(nullptr, " ", &str_ptr), i++) {
|
for (char *str = strtok_r(version_dup, " ", &str_ptr); str && i < 5; str = strtok_r(nullptr, " ", &str_ptr), i++) {
|
||||||
int field = atoi(str);
|
int field = atoi(str);
|
||||||
// The fields in a version string can only range from 1-255.
|
// The fields in a version string can only range from 1-30000.
|
||||||
// and following value must be higher than previous one
|
// and following value must be higher than previous one
|
||||||
if ((field <= 0) || (field > 255) || ( (i>0) && (field <= messwerte[i-1]) ) ) {
|
if ((field <= 0) || (field > 30000) || ( (i>0) && (field <= messwerte[i-1]) ) ) {
|
||||||
free(version_dup);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
messwerte[i] = field;
|
messwerte[i] = field;
|
||||||
}
|
}
|
||||||
|
free(version_dup);
|
||||||
for (i=0 ; i < 5 ; i++) {
|
for (i=0 ; i < 5 ; i++) {
|
||||||
Settings.shuttercoeff[i][XdrvMailbox.index -1] = messwerte[i] * 1000 / messwerte[4];
|
Settings.shuttercoeff[i][XdrvMailbox.index -1] = (uint32_t)messwerte[i] * 1000 / messwerte[4];
|
||||||
AddLog_P2(LOG_LEVEL_INFO, PSTR("Settings.shuttercoeff: %d, i: %d, value: %d, messwert %d"), i,XdrvMailbox.index -1,Settings.shuttercoeff[i][XdrvMailbox.index -1], messwerte[i]);
|
AddLog_P2(LOG_LEVEL_INFO, PSTR("Settings.shuttercoeff: %d, i: %d, value: %d, messwert %d"), i,XdrvMailbox.index -1,Settings.shuttercoeff[i][XdrvMailbox.index -1], messwerte[i]);
|
||||||
}
|
}
|
||||||
ShutterInit();
|
ShutterInit();
|
||||||
ResponseCmndIdxChar(XdrvMailbox.data);
|
ResponseCmndIdxChar(XdrvMailbox.data);
|
||||||
|
} else {
|
||||||
|
char setting_chr[30] = "0";
|
||||||
|
snprintf_P(setting_chr, sizeof(setting_chr), PSTR("%d %d %d %d %d"), Settings.shuttercoeff[0][XdrvMailbox.index -1], Settings.shuttercoeff[1][XdrvMailbox.index -1], Settings.shuttercoeff[2][XdrvMailbox.index -1], Settings.shuttercoeff[3][XdrvMailbox.index -1], Settings.shuttercoeff[4][XdrvMailbox.index -1]);
|
||||||
|
ResponseCmndIdxChar(setting_chr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user