Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

shuttermotorstop init value, new max 5000 #17484

Merged
merged 1 commit into from
Dec 22, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions tasmota/tasmota_xdrv_driver/xdrv_27_shutter.ino
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,8 @@ struct SHUTTER {
uint16_t venetian_delay = 0; // Delay in steps before venetian shutter start physical moving. Based on tilt position
uint16_t min_realPositionChange = 0; // minimum change of the position before the shutter operates. different for PWM and time based operations
uint16_t min_TiltChange = 0; // minimum change of the tilt before the shutter operates. different for PWM and time based operations
uint16_t last_reported_time =0;
uint32_t last_stop_time = 0; // record the last time the relay was switched off
uint16_t last_reported_time = 0; // get information on skipped 50ms loop() slots
uint32_t last_stop_time = 0; // record the last time the relay was switched off
} Shutter[MAX_SHUTTERS];

struct SHUTTERGLOBAL {
Expand Down Expand Up @@ -351,9 +351,16 @@ void ShutterInit(void)
Shutter[i].lastdirection = (50 < Settings->shutter_position[i]) ? 1 : -1;

// Venetian Blind
// ensure min is smaller than max
Settings->shutter_tilt_config[2][i] = Settings->shutter_tilt_config[0][i] >= Settings->shutter_tilt_config[1][i]?0:Settings->shutter_tilt_config[2][i];
//copy config to shutter
for (uint8_t k=0; k<5; k++) {
Shutter[i].tilt_config[k] = Settings->shutter_tilt_config[k][i];
}
// wipe open/close position if duration is 0
if (Shutter[i].tilt_config[2]==0) {
Shutter[i].tilt_config[3] = Shutter[i].tilt_config[4] = 0;
}
Shutter[i].tilt_target_pos = Shutter[i].tilt_real_pos = Settings->shutter_tilt_pos[i];

Shutter[i].tilt_velocity = Shutter[i].tilt_config[2] > 0 ? ((Shutter[i].tilt_config[1]-Shutter[i].tilt_config[0])/Shutter[i].tilt_config[2])+1 : 1;
Expand Down Expand Up @@ -395,7 +402,7 @@ void ShutterInit(void)
Settings->shutter_accuracy = 1;
Settings->shutter_mode = ShutterGlobal.position_mode;
// initialize MotorStop time with 500ms if not set
Settings->shutter_motorstop = (Settings->shutter_motorstop == 0) ? 500 : Settings->shutter_motorstop;
Settings->shutter_motorstop = (Settings->shutter_motorstop == 0) ? 500 : tmin(5000,Settings->shutter_motorstop);
}
}

Expand Down Expand Up @@ -1776,6 +1783,7 @@ void CmndShutterMotorStop(void)
if (!XdrvMailbox.usridx) {
if ((XdrvMailbox.payload >= 0) ) {
Settings->shutter_motorstop = XdrvMailbox.payload;
ShutterInit();
}
ResponseCmndNumber(Settings->shutter_motorstop);
}
Expand Down