From 8bc5424607113af4f636c8ede275bf6763f70640 Mon Sep 17 00:00:00 2001 From: Stefan `Sec` Zehl Date: Sun, 31 Jul 2011 00:53:53 +0200 Subject: [PATCH] Fix time and generation handling a bit --- firmware/funk/mesh.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/firmware/funk/mesh.c b/firmware/funk/mesh.c index e0f869f..4928cae 100644 --- a/firmware/funk/mesh.c +++ b/firmware/funk/mesh.c @@ -68,13 +68,15 @@ void mesh_recvloop(void){ pktctr++; if(MO_GEN(buf)>meshgen){ - meshgen++; + if(meshgen) + meshgen++; + else + meshgen=MO_GEN(buf); _timet=0; - continue; }; if(MO_TYPE(buf)=='T'){ - time_t toff=MO_TIME(buf)-(getTimer()*SYSTICKSPEED/1000); + time_t toff=MO_TIME(buf)-((getTimer()-(200/SYSTICKSPEED))/(1000/SYSTICKSPEED)); if (toff>_timet) // Do not live in the past. _timet = toff; continue;