Repository navigation
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 andreset()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()andreset()are now safe to call whileupdate()runs from a timer interrupt.tx,busyandcur_chararevolatile.- Pin 0 is never written when it's used to mean "no output pin", and
led_pinis 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.jsonfor 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
Morseclass: useMorse::TX_BUFFER_SIZE,Morse::DEFAULT_WPMand 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: runmaketo test on your computer, ormake qemuto test on an emulated Cortex-M0 (the SAMD21's processor family).