-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
with 2 shutters configured, the second shutter affects the first shutter. #10860
Comments
While testing by pressing the sutter2 open and close buttons. I found this in the logs"
Why is the shutter relay mask wrong? |
Maybe found an issue that is turning on relay 3 for shutter1 at line 1080 in the shutter code: if (ShutterGlobal.position_mode != SHT_TIME_UP_DOWN) ExecuteCommandPowerShutter(Settings.shutter_startrelay[index]+2, 1, SRC_SHUTTER); adds +2 to the relay number. removed this and fixed my code with a servo. Now sure what this line is here for? May break someone else's shutter code. Still looking at other issue with shutter1 moving when operating shutter2. |
I have also found that the line of code below is causing an Exception 0. When comment out this line the exception does not happen. When I put it back the Exception comes back. line 386 Shutter[i].accelerator = - tmin(tmax( velocity_change_per_step_maxtoBeAcc/100 , (velocity_change_per_step_max9/10)), (velocity_change_per_step_max*11/10)); Console log of the reset with Exception 0
|
Found another issue in the shutter code. line 461 snprintf_P(scmnd, sizeof(scmnd), PSTR(D_CMND_PWM " %d" ),Shutter[i].pwm_value); this command needs to include the shutter index. Other wise it is always working on shutter 1. This is now fixed in #10893 |
@stefanbode Are you available to work on these issues? If so how to resolve this: if (ShutterGlobal.position_mode != SHT_TIME_UP_DOWN) ExecuteCommandPowerShutter(Settings.shutter_startrelay[index]+2, 1, SRC_SHUTTER); adds +2 to the relay number. removed this and fixed my code with a servo. Now sure what this line is here for? May break someone else's shutter code. Change the +2 or just comment out the whole line? Thanks |
The idea is to have the servo power on relay 3. That's save energy when the servo do not move. It should be in the docu. Same for the stepper motor. Relay 3 is on the enable pin. |
@stefanbode Thank you for the reply. But you did not answer the question. How to resolve this bug in the code: if (ShutterGlobal.position_mode != SHT_TIME_UP_DOWN) ExecuteCommandPowerShutter(Settings.shutter_startrelay[index]+2, 1, SRC_SHUTTER); adds +2 to the relay number. Increasing the relay number by 2 which is 1 past the valid relay number for that servo. @stefanbode How would you fix this? Thanks |
The reason is how TASMOTA handle PWM "relays". For these shutters the RELAY1 is ON/OFF, RELAY2 is DIRECTION and RELAY3 is the PWM. You can change this but with default configuration you get an additional relay as soon as you define one PWM. With this line I ensure the PWM is on. Otherwhise neither the stepper nor the servo will work. But I agree there is an issue, if you have 2 or 3 shutter because the PWM are always added to the END. Therefore the "+2" is not correct. I t must depend on the shutter number and the total shutters defined. uff... Maybe there is a better way to get the relay number, if you know it is PWM3. |
@arendst : Do we have a function where I can POWER ON the PWM2. My problem is: depending on the amount of "normal" relays I have no idea on which relay number the PWM2 is defined. I want to have a replacement for the bold one. |
I will investigate. Give some time. |
For the stepper it is ok to untouch it, but for the servo it makes sense to switch it on/off so there is no PWM signal anymore on the servo. In the current commit I removed the line |
@stefanbode thank you for the relay fix. I still have 1 issue with this configuration. That is system reboot.
When Shutter[i].accelerator is negative and Shutter[i].pwm_velocity goes to 0. Have have found that if you Shutter[i].pwm_velocity for 0 and force to 100 then it all works. Although I do not believe this is a final solution. So changing the code to this seems to have resolved the problem.
Do you agree? |
@mikep1998 : yes I agree. The PWMfrequency is hardcoded in the Arduino SDK to 100Hz. You cannot get lower. I already submitted this yesterday as you also posted above in the case of SHT_COUNTER. For all other speed controlled shutter like the SERVO there is no limit of 100. This can and must go down to 0. I tested yesterday with the STEPPER motor and did not get any reboots. I also have a problem understanding why 0 is a problem. The only thing I can image is a WATCHDOG reboot. Please can you try to change the line from:
to
1 is the lowest value and it is fine. What kind of shutter mode do you have? where does the error occur? |
@stefanbode Hello, I am using the shutter code to tilt my blinds. I am controlling a MG995 servo. I have tried pwm_velocity values 0, 1, 10, 50, 99 all of these fail with reboot. Only 100 or above work fine. I can not find the reason of the reboot. May be WATCHDOG or DIVIDE by ZERO. If you know how to check which reboot error please tell me how. The settings I use are: SetOption80 1 The error occurs when opening or closing the blinds. near the end of movement. |
@stefanbode Hello, I just loaded the latest developement 9.3.0.1
When I change the code to this it works fine. 100 instead of 0.
|
Found it. Will fix today |
@stefanbode Hello, I have tried the latest code with the 2 commits and the Exception 0 is still there.
Let me know if you need anything else? |
Ok there is a DIV 0 exception when the velocity == 0. This causes the reboot. This is easy to fix. And maybe the 200 as a minimum might also be a solution. Currently, I do see some mistakes in the calculation of the stop-way and stop-time. This causes the velocity==0 before reaching the final position. I have now a testbench with a stepper and a servo because both use the accelerate/decelerate functions but in a very different way. |
OK, removed some fancy functions and streamline the decelerate process. The bug is removed for sure because this was part of the "adaption" procedure that is now completely removed. To Stop the servo or stepper this is now mathematically calculated and not "on the fly" corrected. Please can you give it a try and give feedback. I had some issues with my servo. Sometimes work, sometimes move nothing.... |
@stefanbode Hello, I have tried the latest code from your branch and it works without any errors. Thanks for the fix. |
Heureka. I was a little bit surprised about your fast servos. My did not work on that openduration. |
My servos are only turning the tilt operation of the blinds. 180 degrees from close to open to close. I have actually extended the time to 10 seconds and now they run quieter. I'm glad you removed most of the complex code. I don't think Servos need an acceleration or deacceleration you can only slow then down by taking a baby step and then wait and then step again. Thanks |
hi mike. The deceleration is still part also of the servo. Just the calculation is simplified. I agree that there is no ramp required if the load on the servo is low. If you have heavy mass to move the ramp really helps to keep your servo healthy. last not least: please can you close the case. THX |
@arendst I am trying to make 2 shutters working on a board with 4 relays but relays 3 and 4 never gets interlocked. Can you advise? |
The shutterrelay2 must be 3. it is always the first relay to assign to the shuttergroup. |
PROBLEM DESCRIPTION
A clear and concise description of what the problem is.
When operating shutter1, shutter1 relays toggle on and off. Shutter1 open and closes correctly. But shutter2 relay3 turns ON and never turns off.
When clicking the open or close button for shutter2, shutter2 opens or closes. But shutter1 also moves.
REQUESTED INFORMATION
Make sure your have performed every step and checked the applicable boxes before submitting your issue. Thank you!
Backlog Template; Module; GPIO 255
:Backlog Rule1; Rule2; Rule3
:Status 0
:weblog
to 4 and then, when you experience your issue, provide the output of the Console log:TO REPRODUCE
Steps to reproduce the behavior:
These are commands to setup the servo shutters.
Backlog SetOption80 1; Shuttermode 5; SetOption15 0; PWMfrequency 200; ShutterRelay1 1; ShutterRelay2 3; ShutterPwmRange1 100, 500; ShutterPwmRange2 100, 500; ShutterOpenDuration1 2.5; ShutterOpenDuration2 2.5; ShutterCloseDuration1 2.5; ShutterCloseDuration2 2.5; ShutterMotorDelay1 0.2; ShutterMotorDelay2 0.2; Restart 1
EXPECTED BEHAVIOUR
A clear and concise description of what you expected to happen.
clicking shutter1 only affects shutter1.
Clicking shutter2 should only affects shutter2.
before clicking shutter1 open all relays are off.

after only clicking shutter1 open relays1 and relay3 are ON.
SCREENSHOTS
If applicable, add screenshots to help explain your problem.
ADDITIONAL CONTEXT
Add any other context about the problem here.
(Please, remember to close the issue when the problem has been addressed)
The text was updated successfully, but these errors were encountered: