Fix shutter JSON

This commit is contained in:
Theo Arends 2020-01-04 14:20:41 +01:00
parent a1df6b9db9
commit 8be7dbe235
1 changed files with 16 additions and 15 deletions

View File

@ -242,7 +242,6 @@ void ShutterInit(void)
}
}
void ShutterReportPosition(bool always = false)
{
uint16_t shutter_moving = 0;
@ -258,13 +257,15 @@ void ShutterReportPosition(bool always = false)
//Settings.shutter_position[i] = Settings.shuttercoeff[2][i] * 5 > Shutter.real_position[i] ? Shutter.real_position[i] / Settings.shuttercoeff[2][i] : (Shutter.real_position[i]-Settings.shuttercoeff[0,i]) / Settings.shuttercoeff[1][i];
AddLog_P2(LOG_LEVEL_INFO, MSG_SHUTTER_POS, i+1, Shutter.real_position[i], Shutter.start_position[i], Shutter.target_position[i], Shutter.direction[i], Shutter.motordelay[i],stemp2,Shutter.pwm_frequency);
}
if (i) { ResponseAppend_P(PSTR(",")); }
ResponseAppend_P(JSON_SHUTTER_POS, i+1, Settings.shutter_invert[i] ? 100-position : position, Shutter.direction[i]);
if (i < shutters_present - 1)
ResponseAppend_P(PSTR(", "));
// if (i < shutters_present - 1)
// ResponseAppend_P(PSTR(", "));
}
ResponseJsonEnd();
if (always || shutter_moving == 1) {
MqttPublishPrefixTopic_P(RESULT_OR_TELE, mqtt_data);
if (always || (1 == shutter_moving)) {
MqttPublishPrefixTopic_P(RESULT_OR_TELE, PSTR(D_PRFX_SHUTTER));
}
if (rules_flag.shutter_moving > shutter_moving) {
rules_flag.shutter_moved = 1;