Skip to content

Commit 54b0e2d

Browse files
committed
version 1.86
1 parent 19b6a6f commit 54b0e2d

13 files changed

+1593
-135
lines changed

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -327,6 +327,11 @@ sudo service serial-port-json-server start
327327

328328
Revisions
329329
-------
330+
Changes in 1.86
331+
- Added "Pause" value in sendjson command so you can ask SPJS to pause after sending a serial command. This was needed because on Atmel processors during an EEPROM write all data is dropped that is sent in on the serial lines. To use this value, send in a sendjson command similar to the following:
332+
`sendjson {"P":"COM7","Data":[{"D":"{\"ej\":1}\n","Id":"tinygInit-cmd182","Pause":50}]}`
333+
- Added "tinyg_tidmode" buffer which is the most advanced buffer ever added to SPJS. This buffer uses a primary key for each line sent to TinyG and TinyG sends back the primary key as it processes each line. This means that SPJS will be in 100% perfect sync with TinyG. This will solve the longstanding hard-to-find bug where users would occasionally get random pausing because SPJS thought TinyG's buffer was full, but it really wasn't.
334+
330335
Changes in 1.85
331336
- Moved back to original serial library that was used in 1.80 and away from the new one that the Arduino team added that was used in 1.83. Too many problems were happening with mangled characters in 1.83.
332337

bufferflow.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import (
55
//"time"
66
)
77

8-
var availableBufferAlgorithms = []string{"default", "tinyg", "tinyg_linemode", "tinygg2", "grbl", "marlin"}
8+
var availableBufferAlgorithms = []string{"default", "tinyg", "tinyg_linemode", "tinyg_tidmode", "tinygg2", "grbl", "marlin"}
99

1010
//var availableBufferAlgorithms = []string{"default", "tinyg", "tinygg2", "dummypause", "grbl"}
1111

@@ -18,7 +18,7 @@ type BufferMsg struct {
1818
}
1919

2020
type Bufferflow interface {
21-
BlockUntilReady(cmd string, id string) (bool, bool) // implement this method
21+
BlockUntilReady(cmd string, id string) (bool, bool, string) // implement this method
2222
//JustQueue(cmd string, id string) bool // implement this method
2323
OnIncomingData(data string) // implement this method
2424
ClearOutSemaphore() // implement this method
@@ -35,6 +35,7 @@ type Bufferflow interface {
3535
ReleaseLock() // implement this method
3636
IsBufferGloballySendingBackIncomingData() bool // implement this method
3737
Close() // implement this method
38+
RewriteSerialData(cmd string, id string) string // implement this method
3839
}
3940

4041
/*data packets returned to client*/

bufferflow_default.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,13 @@ func (b *BufferflowDefault) Init() {
1818
log.Println("Initting default buffer flow (which means no buffering)")
1919
}
2020

21-
func (b *BufferflowDefault) BlockUntilReady(cmd string, id string) (bool, bool) {
21+
func (b *BufferflowDefault) RewriteSerialData(cmd string, id string) string {
22+
return ""
23+
}
24+
25+
func (b *BufferflowDefault) BlockUntilReady(cmd string, id string) (bool, bool, string) {
2226
//log.Printf("BlockUntilReady() start\n")
23-
return true, false
27+
return true, false, ""
2428
}
2529

2630
func (b *BufferflowDefault) OnIncomingData(data string) {

bufferflow_dummypause.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,19 @@ type BufferflowDummypause struct {
1515
func (b *BufferflowDummypause) Init() {
1616
}
1717

18-
func (b *BufferflowDummypause) BlockUntilReady(cmd string, id string) (bool, bool) {
18+
func (b *BufferflowDummypause) RewriteSerialData(cmd string, id string) string {
19+
return ""
20+
}
21+
22+
func (b *BufferflowDummypause) BlockUntilReady(cmd string, id string) (bool, bool, string) {
1923
log.Printf("BlockUntilReady() start. numLines:%v\n", b.NumLines)
2024
log.Printf("buffer:%v\n", b)
2125
//for b.Paused {
2226
log.Println("We are paused for 3 seconds. Yeilding send.")
2327
time.Sleep(3000 * time.Millisecond)
2428
//}
2529
log.Printf("BlockUntilReady() end\n")
26-
return true, false
30+
return true, false, ""
2731
}
2832

2933
func (b *BufferflowDummypause) OnIncomingData(data string) {

bufferflow_grbl.go

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,11 @@ func (b *BufferflowGrbl) Init() {
5959
b.rptQueryLoop(b.parent_serport)
6060
}
6161

62-
func (b *BufferflowGrbl) BlockUntilReady(cmd string, id string) (bool, bool) {
62+
func (b *BufferflowGrbl) RewriteSerialData(cmd string, id string) string {
63+
return ""
64+
}
65+
66+
func (b *BufferflowGrbl) BlockUntilReady(cmd string, id string) (bool, bool, string) {
6367
log.Printf("BlockUntilReady() start\n")
6468

6569
b.q.Push(cmd, id)
@@ -90,12 +94,12 @@ func (b *BufferflowGrbl) BlockUntilReady(cmd string, id string) (bool, bool) {
9094
log.Println("This was an unblock of type 2, which means we're being asked to wipe internal buffer. so return false.")
9195
// returning false asks the calling method to wipe the serial send once
9296
// this function returns
93-
return false, false
97+
return false, false, ""
9498
}
9599

96100
log.Printf("BlockUntilReady(cmd:%v, id:%v) end\n", cmd, id)
97101
}
98-
return true, true
102+
return true, true, ""
99103
}
100104

101105
func (b *BufferflowGrbl) OnIncomingData(data string) {

bufferflow_marlin.go

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,11 @@ func (b *BufferflowMarlin) Init() {
5959
b.rptQueryLoop(b.parent_serport) // Disable the query loop
6060
}
6161

62-
func (b *BufferflowMarlin) BlockUntilReady(cmd string, id string) (bool, bool) {
62+
func (b *BufferflowMarlin) RewriteSerialData(cmd string, id string) string {
63+
return ""
64+
}
65+
66+
func (b *BufferflowMarlin) BlockUntilReady(cmd string, id string) (bool, bool, string) {
6367
log.Printf("BlockUntilReady() start\n")
6468

6569
b.q.Push(cmd, id)
@@ -90,12 +94,12 @@ func (b *BufferflowMarlin) BlockUntilReady(cmd string, id string) (bool, bool) {
9094
log.Println("This was an unblock of type 2, which means we're being asked to wipe internal buffer. so return false.")
9195
// returning false asks the calling method to wipe the serial send once
9296
// this function returns
93-
return false, false
97+
return false, false, ""
9498
}
9599

96100
log.Printf("BlockUntilReady(cmd:%v, id:%v) end\n", cmd, id)
97101
}
98-
return true, true
102+
return true, true, ""
99103
}
100104

101105
func (b *BufferflowMarlin) OnIncomingData(data string) {

bufferflow_tinyg.go

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -246,8 +246,12 @@ func (b *BufferflowTinyg) Init() {
246246
}()
247247
}
248248

249+
func (b *BufferflowTinyg) RewriteSerialData(cmd string, id string) string {
250+
return ""
251+
}
252+
249253
// Serial buffer size approach
250-
func (b *BufferflowTinyg) BlockUntilReady(cmd string, id string) (bool, bool) {
254+
func (b *BufferflowTinyg) BlockUntilReady(cmd string, id string) (bool, bool, string) {
251255
log.Printf("BlockUntilReady(cmd:%v, id:%v) start\n", cmd, id)
252256

253257
// Since BlockUntilReady is in the writer thread, lock so the reader
@@ -310,7 +314,7 @@ func (b *BufferflowTinyg) BlockUntilReady(cmd string, id string) (bool, bool) {
310314
log.Println("This was an unblock of type 2, which means we're being asked to wipe internal buffer. so return false.")
311315
// returning false asks the calling method to wipe the serial send once
312316
// this function returns
313-
return false, false
317+
return false, false, ""
314318
}
315319
}
316320

@@ -324,7 +328,7 @@ func (b *BufferflowTinyg) BlockUntilReady(cmd string, id string) (bool, bool) {
324328

325329
//log.Printf("BlockUntilReady(cmd:%v, id:%v) end\n", cmd, id)
326330

327-
return true, willHandleCompleteResponse
331+
return true, willHandleCompleteResponse, ""
328332
}
329333

330334
// Serial buffer size approach

bufferflow_tinygg2.go

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -183,8 +183,12 @@ func (b *BufferflowTinygG2) Init() {
183183
}()
184184
}
185185

186+
func (b *BufferflowTinygG2) RewriteSerialData(cmd string, id string) string {
187+
return ""
188+
}
189+
186190
// Serial buffer size approach
187-
func (b *BufferflowTinygG2) BlockUntilReady(cmd string, id string) (bool, bool) {
191+
func (b *BufferflowTinygG2) BlockUntilReady(cmd string, id string) (bool, bool, string) {
188192
log.Printf("BlockUntilReady(cmd:%v, id:%v) start\n", cmd, id)
189193

190194
// Since BlockUntilReady is in the writer thread, lock so the reader
@@ -247,7 +251,7 @@ func (b *BufferflowTinygG2) BlockUntilReady(cmd string, id string) (bool, bool)
247251
log.Println("This was an unblock of type 2, which means we're being asked to wipe internal buffer. so return false.")
248252
// returning false asks the calling method to wipe the serial send once
249253
// this function returns
250-
return false, false
254+
return false, false, ""
251255
}
252256
}
253257

@@ -261,7 +265,7 @@ func (b *BufferflowTinygG2) BlockUntilReady(cmd string, id string) (bool, bool)
261265

262266
//log.Printf("BlockUntilReady(cmd:%v, id:%v) end\n", cmd, id)
263267

264-
return true, willHandleCompleteResponse
268+
return true, willHandleCompleteResponse, ""
265269
}
266270

267271
// Serial buffer size approach

0 commit comments

Comments
 (0)