B4R Question [Solved]Problem with inline c (ntp client)

Siam

Active Member
Licensed User
Longtime User
Hello,

based on the library : https://github.com/aharshac/EasyNTPClient

i have a problem if i call the inline c code once i get the aktual Timestamp after the first call i will never receive new data :(
i'm not realy a c guru so i hope someone can say me what i make wrong here.

grettings

Andy



B4X:
#Region Project Attributes
    #AutoFlushLogs: True
    #CheckArrayBounds: True
    #StackBufferSize: 900
#End Region

Sub Process_Globals  
       Public timestamp As ULong
    Public utc As Int=1
    Public timeserver As String = "fritz.box"
end sub

Private Sub AppStart
   
    Serial1.Initialize(115200)
    Log("AppStart")
   
    wifi.Connect2("***","***")
        RunNative("update",Null)
        delay (60000)
       RunNative("update",Null)
end sub

#If c
#include <EasyNTPClient.h>

void update(B4R::Object* o) {
    WiFiUDP udp;
    EasyNTPClient ntpClient(udp, b4r_main::_timeserver->data, ((b4r_main::_utc*60*60)));
    Serial.println(ntpClient.getUnixTime());  
}
#end if
 
Top