Skip to content

v1.2.0

Latest

Choose a tag to compare

@NT7S NT7S released this 22 Nov 23:09
08ba9d2

Fixes Morse code being sent slower than the set speed, plus several memory-safety and interrupt-safety bugs.

Fixes

  • Sending speed. Letters were spaced 4 dits apart and words 11, instead of the standard 3 and 7, and every gap ran a few milliseconds long. Code at a setting of 25 WPM was really going out at about 21 WPM. Timing is now exact: "PARIS " takes 50 dits.
  • Messages longer than 100 characters no longer overflow the buffer; they are truncated.
  • Unsupported characters (tabs, newlines, {|}~, non-ASCII) are now skipped instead of sending garbage. Empty messages and reset() no longer send a stray character.
  • The state machine no longer hangs when the 1 ms tick counter wraps around after 49.7 days.
  • send(), setWPM() and reset() are now safe to call while update() runs from a timer interrupt. tx, busy and cur_char are volatile.
  • Pin 0 is never written when it's used to mean "no output pin", and led_pin is configured as an output.
  • reset() turns the output pin off. In DFCW mode, the carrier turns off when a message ends.
  • setWPM() limits the speed to 0.01–1200 WPM instead of dividing by zero.

Other changes

  • Added library.json for PlatformIO (lib_deps = etherkit/Etherkit Morse).

Upgrade notes

  • Code now goes out at the WPM you set, which is noticeably faster than before at the same setting.
  • The library constants are now members of the Morse class: use Morse::TX_BUFFER_SIZE, Morse::DEFAULT_WPM and so on. Sketches that used the old global names need updating.
  • In DFCW mode, the output pin now goes low when a message ends.

Testing

  • Verified on an ATtiny3226 (megaTinyCore).
  • New regression tests in extras/test: run make to test on your computer, or make qemu to test on an emulated Cortex-M0 (the SAMD21's processor family).