monome / druid

terminal interface for crow
GNU General Public License v3.0
35 stars 16 forks source link

hack to handle 64byte length lines #54

Closed trentgill closed 5 years ago

trentgill commented 5 years ago

Turns out the line-ending issue was potentially a red-herring.

This PR removes the forced line-ending encoding as crow should handle either line-endings gracefully.

This does however introduce a gross hack to solve a problem where transmissions of exactly 64bytes would cause crow to stop receiving further data. This solution adds an additonal newline character which crow discards anyway, and remains active. Confusingly this hack is ony needed on windows & osx (not linux).

64bytes is the size of the USB-buffer endpoints on crow. See the following files in the crow project: crow/submodules/STM32_Cube_F7/Middlewares/ST/STM32_USB_Device_Library/Core/Inc/usbd_def.h @114-115 crow/submodules/STM32_Cube_F7/Middlewares/ST/STM32_USB_Device_Library/Class/CDC/Inc/usbd_cdc.h @58

Tested on lin/win/osx with a number of scripts using both r and u.

trentgill commented 5 years ago

@tehn nightmare!!

csboling commented 5 years ago

Oof. Sorry for the line ending goose chase. Should this check if line length mod 64 == 0? A 128 character line seems extreme but possible, especially for initializing a long table or something?

simonvanderveldt commented 5 years ago

:scream:

trentgill commented 5 years ago

@csboling not at all! it was key to finding the underlying issue! re: modulo, that's a very good point, i'll check now but it seems len==128 would cause the same problem.

trentgill commented 5 years ago

Indeed 128bytes was crashing too! Merging now.