One of the features of my greenhouse controller is to send an email at 6AM and 6PM each day logging the min/max internal temperature between emails. Randomly the low temperature value was incorrect rather than being min for the entire period it is getting reset to current temp sometime through the 12hr period. The way my code works is once the email is sent, VAR1 is set to 1000 and decremented each pass through user code. When it gets to 0 min/max value for previous period is reset. This provides enough time for the email to be sent before the values are reset.
Controller is WebControl v03.02.17d (early version no boot loader). I added some debug code to send a test email each time the min/max temperate gets reset. I'm using VAR1 for three purposes: If VAR 1 is 0 - new min max value set, if value is 1-1000 delay routine that allows email to be sent before temp values are updated, and value of 1001 indicates email has been sent and to accumulate current min/max value during the 12 hour period.
What I'm seeing is VAR1 randomly gets reset to 0. Double checked the only time my code does that is when value is decremented after 6AM and 6PM email sent. As a test moved VAR1 code to VAR8. Did a one time set of VAR1 to 1234. Problem still occurs using VAR8 and when it does VAR1 is reset to 0.
VAR reset occurs at multiple times of day and some times when it occurs my test code sends a single email but some times more than one indicating the VAR is being reset for multiple passes through user code.
Hard to believe this is a WebControl FW bug, since it is pretty significant and others would have noticed but I cannot fine anything wrong with my code.
Here is the fragment of my code.
VAR8 - Email delay state: 0=set min/max temp to current, 1-1000=temp reset delay, 1001 email sent
EMSTATUS:
TSTEQ VAR8 0
GOTO NEWMINMAX ;set new 12 hr min/max value
TSTEQ VAR8 1001
GOTO LOGGER ;update 12 hr min/max value.
DEC VAR8
RET
NEWMINMAX:
EMAIL EM6 :test email
DELAY 5000 ;blocking delay for test email
SET VAR8 1001
SET VAR4 T2 ;max inside temp
SET VAR5 T2 ;min inside temp
RET
LOGGER:
TSTGT T2 VAR4
SET VAR4 T2
TSTLT T2 VAR5
SET VAR5 T2
TSTEQ CH 6
GOTO MORNMAIL ;send 6AM email
TSTEQ CH 18
GOTO EVENMAIL ;sent 6 PM email
RET
MORNMAIL:
TSTEQ VAR6 18
RET
EMAIL EM7
SET VAR6 18
SET VAR8 1000
RET
EVENMAIL:
TSTEQ VAR6 6
RET
EMAIL EM8
SET VAR6 6
SET VAR8 1000
RET
Controller is WebControl v03.02.17d (early version no boot loader). I added some debug code to send a test email each time the min/max temperate gets reset. I'm using VAR1 for three purposes: If VAR 1 is 0 - new min max value set, if value is 1-1000 delay routine that allows email to be sent before temp values are updated, and value of 1001 indicates email has been sent and to accumulate current min/max value during the 12 hour period.
What I'm seeing is VAR1 randomly gets reset to 0. Double checked the only time my code does that is when value is decremented after 6AM and 6PM email sent. As a test moved VAR1 code to VAR8. Did a one time set of VAR1 to 1234. Problem still occurs using VAR8 and when it does VAR1 is reset to 0.
VAR reset occurs at multiple times of day and some times when it occurs my test code sends a single email but some times more than one indicating the VAR is being reset for multiple passes through user code.
Hard to believe this is a WebControl FW bug, since it is pretty significant and others would have noticed but I cannot fine anything wrong with my code.
Here is the fragment of my code.
VAR8 - Email delay state: 0=set min/max temp to current, 1-1000=temp reset delay, 1001 email sent
EMSTATUS:
TSTEQ VAR8 0
GOTO NEWMINMAX ;set new 12 hr min/max value
TSTEQ VAR8 1001
GOTO LOGGER ;update 12 hr min/max value.
DEC VAR8
RET
NEWMINMAX:
EMAIL EM6 :test email
DELAY 5000 ;blocking delay for test email
SET VAR8 1001
SET VAR4 T2 ;max inside temp
SET VAR5 T2 ;min inside temp
RET
LOGGER:
TSTGT T2 VAR4
SET VAR4 T2
TSTLT T2 VAR5
SET VAR5 T2
TSTEQ CH 6
GOTO MORNMAIL ;send 6AM email
TSTEQ CH 18
GOTO EVENMAIL ;sent 6 PM email
RET
MORNMAIL:
TSTEQ VAR6 18
RET
EMAIL EM7
SET VAR6 18
SET VAR8 1000
RET
EVENMAIL:
TSTEQ VAR6 6
RET
EMAIL EM8
SET VAR6 6
SET VAR8 1000
RET