Skip to content

Commit

Permalink
Release 1.1.0
Browse files Browse the repository at this point in the history
* Fixes #2
* Bumping requirements to Nim 2.0 just because.
  • Loading branch information
Mihara committed Oct 1, 2023
1 parent 561b455 commit fe9fc01
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 7 deletions.
18 changes: 14 additions & 4 deletions src/x1c3tool.nim
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,14 @@ commandline:
exitoption("help", "h", helpMessage())
errormsg("--help for help.")

proc fullFlush(port: SerialStream) =
# Flush the port and clear the read buffer too.
port.flush()
try:
discard port.readAll()
except TimeoutError:
discard

var
port: SerialStream

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

# Flush the port first.
try:
discard port.readAll()
except TimeoutError:
discard
port.fullFlush()

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

# Now, on platforms other than Windows, that would be all it takes,
# but on Windows, streams seem to behave differently,
# and without this, it won't finish writing to the port.
port.fullFlush()

else:
echo("Nothing to upload or download.")

Expand Down
6 changes: 3 additions & 3 deletions x1c3tool.nimble
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Package

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

# Dependencies

requires "nim >= 1.6.0"
requires "serial >= 1.1.5"
requires "nim >= 2.0.0"
requires "https://github.com/euantorano/serial.nim#e794dd3"
requires "commandant >= 0.15.0"

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

0 comments on commit fe9fc01

Please sign in to comment.