B4R Question Timer1 Looper behavior ?


Licensed User
Is this known behavior ? I took Erel's example of a Timer,and Looper to blink a led on D4 esp8266. B4R v3.3 Arduino 1.85.
Each cycle thru the loops per millisecond decreases. It starts at 135.xxxx and about every 50 seconds it decreases by one, 134.xxxx ? Left it running for 12 hours. It went down to 9.xxxx loops per millisecond. (not sure as the log doesn't go back that far)
As of now it is climbing backup it is currently at 13.8603 and takes about 50 seconds to increase by 0.1 loops per second, 13.9603. Led is consistently blinking at 5 second intervals.

Did I just roll a counter over or something ? Running Win10 memory and cpu is consistent for B4R. (It is just logging to the pc, where b4r IDE is located. EXE is running on the esp8266.)

This is just an observation on my part. Was working on something else when I noticed this behavior.

Sub Process_Globals
    Public Serial1 As Serial
    Private counter As ULong
    Public dp As D1Pins
    Public blink As Pin
    Public Timer1 As Timer
End Sub

Private Sub AppStart
    blink.Initialize(dp.D4, blink.MODE_OUTPUT)
    Timer1.Initialize("Timer1_Tick", 5000)
    Timer1.Enabled = True 'don't forget to enable it
End Sub

Sub Looper1
    counter = counter + 1
    If counter Mod 100000 = 0 Then
        Log("Took me ", Millis, " milliseconds to count to ", counter)
        Log(counter / Millis, " loops per milliseconds")
    End If
End Sub

Private Sub Timer1_Tick
   Dim currentState As Boolean = blink.DigitalRead
   'Log("CurrentState: ", currentState)
   Dim NewState As Boolean = Not(currentState)
'   Log("NewState: ", NewState)
End Sub


Licensed User
No complaints here. It was just an observation and did not seem to affect anything in the code. I am a big fan of B4R. Easy to code and it works ! Plus the B4X Community is great ! Anytime I have had an issue someone, including you Erel, has put me on the right track to resolve it. I only wish I had more time to work with B4A and B4J. :)