Fix Status13 shutter exception 9

This commit is contained in:
Theo Arends 2020-09-23 17:13:10 +02:00
parent 765cbe6289
commit bbd15fa174
2 changed files with 14 additions and 2 deletions

View File

@ -117,7 +117,7 @@ String GetResetReason(void)
/*********************************************************************************************\
* Miscellaneous
\*********************************************************************************************/
/*
String GetBinary(const void* ptr, size_t count) {
uint32_t value = *(uint32_t*)ptr;
value <<= (32 - count);
@ -129,6 +129,18 @@ String GetBinary(const void* ptr, size_t count) {
}
return result;
}
*/
String GetBinary8(uint8_t value, size_t count) {
if (count > 8) { count = 8; }
value <<= (8 - count);
String result;
result.reserve(count + 1);
for (uint32_t i = 0; i < count; i++) {
result += (value &0x80) ? '1' : '0';
value <<= 1;
}
return result;
}
// Get span until single character in string
size_t strchrspn(const char *str1, int character)

View File

@ -586,7 +586,7 @@ void CmndStatus(void)
"\"Calib\":\"%d:%d:%d:%d:%d\","
"\"Mode\":\"%d\"}}"),
i, Settings.shutter_startrelay[i], Settings.shutter_startrelay[i] +1, Settings.shutter_opentime[i], Settings.shutter_closetime[i],
Settings.shutter_set50percent[i], Settings.shutter_motordelay[i], GetBinary(&Settings.shutter_options + (i * sizeof(Settings.shutter_options)), 4).c_str(),
Settings.shutter_set50percent[i], Settings.shutter_motordelay[i], GetBinary8(Settings.shutter_options[i], 4).c_str(),
Settings.shuttercoeff[0][i], Settings.shuttercoeff[1][i], Settings.shuttercoeff[2][i], Settings.shuttercoeff[3][i], Settings.shuttercoeff[4][i],
Settings.shutter_mode);
}