Skip to content

Commit fe9fc01

Browse files
committed
Release 1.1.0
* Fixes #2 * Bumping requirements to Nim 2.0 just because.
1 parent 561b455 commit fe9fc01

File tree

2 files changed

+17
-7
lines changed

2 files changed

+17
-7
lines changed

src/x1c3tool.nim

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,14 @@ commandline:
3030
exitoption("help", "h", helpMessage())
3131
errormsg("--help for help.")
3232

33+
proc fullFlush(port: SerialStream) =
34+
# Flush the port and clear the read buffer too.
35+
port.flush()
36+
try:
37+
discard port.readAll()
38+
except TimeoutError:
39+
discard
40+
3341
var
3442
port: SerialStream
3543

@@ -45,10 +53,7 @@ except InvalidSerialPortError:
4553
quit("Could not open serial port " & portName, QuitFailure)
4654

4755
# Flush the port first.
48-
try:
49-
discard port.readAll()
50-
except TimeoutError:
51-
discard
56+
port.fullFlush()
5257

5358
# Get the firmware version number.
5459
port.write("AT+VER=?" & CRLF)
@@ -115,6 +120,11 @@ elif len(uploadFrom) != 0:
115120
port.write("AT+SET=WRITE")
116121
port.write(configBuffer)
117122

123+
# Now, on platforms other than Windows, that would be all it takes,
124+
# but on Windows, streams seem to behave differently,
125+
# and without this, it won't finish writing to the port.
126+
port.fullFlush()
127+
118128
else:
119129
echo("Nothing to upload or download.")
120130

x1c3tool.nimble

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Package
22

3-
version = "1.0.1"
3+
version = "1.1.0"
44
author = "Eugene Medvedev (R2AZE)"
55
description = "A configuration loader and saver for X1C3 APRS Tracker."
66
license = "MIT"
@@ -10,8 +10,8 @@ binDir = "build"
1010

1111
# Dependencies
1212

13-
requires "nim >= 1.6.0"
14-
requires "serial >= 1.1.5"
13+
requires "nim >= 2.0.0"
14+
requires "https://github.com/euantorano/serial.nim#e794dd3"
1515
requires "commandant >= 0.15.0"
1616

1717
# We're already requiring nim >= 1.6.0, so we can assume that 'distros' is available.

0 commit comments

Comments
 (0)