You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
b.PacketCtrMin=12// 3 // if you are at this many packet mode slots left, stop, don't go below it
123
-
b.PacketCtrAvail=30//6 // this is the default number that TinyG starts with
124
-
b.PacketCtrMax=30// how many Line Mode packet counters there are
125
-
126
+
b.PacketCtrMin=10// 3 // if you are at this many packet mode slots left, stop, don't go below it
127
+
b.PacketCtrAvail=24//6 // main variable keeping track of how many Line Mode slots are avaialable in TinyG, this is the default number that TinyG starts with
128
+
b.PacketCtrMax=24// how many Line Mode packet counters there are max on the TinyG firmware
129
+
b.isInReSyncMode=false
126
130
b.testDropCtr=0
131
+
b.reSyncCtr=0
132
+
b.reSyncCtrTriggerAt=41// the number of processed Gcode lines that have us a trigger a resync
127
133
128
134
//b.StartSending = 20
129
135
//b.StopSending = 18
@@ -281,7 +287,30 @@ func (b *BufferflowTinygPktMode) BlockUntilReady(cmd string, id string) (bool, b
281
287
282
288
isNeedToUnlock:=true
283
289
284
-
ifb.PacketCtrAvail<=b.PacketCtrMin {
290
+
// count the amount of outbound lines that will get back an r:{} response
291
+
// and then re-sync after a set amount to reset our Line Mode counter
292
+
/*b.reSyncCtr++
293
+
if b.reSyncCtr >= b.reSyncCtrTriggerAt {
294
+
295
+
// we need to do a re-sync
296
+
b.reSyncStart()
297
+
298
+
// clear all b.sem signals so when we block below, we truly block
299
+
b.ClearOutSemaphore()
300
+
301
+
log.Println("\tBlocking on b.sem for re-sync until told from OnIncomingData to go")
302
+
303
+
// since we need other code to run while we're blocking, we better release the packet ctr lock
304
+
b.packetCtrLock.Unlock()
305
+
306
+
unblockType, ok := <-b.sem // will block until told from OnIncomingData to go
// what to do when we actually get back a Line Mode counter from TinyG
676
+
//b.onGotLineModeCounterFromTinyG(lineCtr)
677
+
678
+
// we just got back what we think is an authoritative answer
679
+
// let's spit out debug to see how far off we are
680
+
log.Printf("Re-sync got back authoritative answer. What we think we should have as available: %v, what TinyG just told us: %v\n", b.PacketCtrAvail, lineCtr)
681
+
682
+
// set our current packet ctr to this val cuz it's authoritative
683
+
b.PacketCtrAvail=lineCtr
684
+
685
+
} else {
686
+
log.Printf("\tERROR in Re-Sync: We could not parse an integer from the Line Mode ctr???\n")
687
+
}
688
+
689
+
} else {
690
+
log.Printf("\tERROR in Re-Sync: We got an r:{\"rx\":...} response but could not parse out the Line Mode counter.\n")
0 commit comments