Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Limit the amount of input we read into memory in arduino sketches. #746

Merged
merged 2 commits into from
Dec 3, 2023

Conversation

balazsracz
Copy link
Collaborator

Adds a pushback mechanism to not read faster from a serial bridge than how fast the stack, or a CAN-bus output can sink packets. This is especially important for USBSerial inputs, which can supply data as fast as we are willing to read it.

The implementation relies on two mechanisms:

  • setting the gridconnect converter to keep track of the CAN frames and only let a fixed number of them (5) exist at any time in the CAN hub.
  • adding a notifiable to the SerialBridge that keep track of the last txt buffer we sent to the gridconnect bridge. We do not read more bytes from the serial port in the read loop until the previous buffer is processed by the gridconnect parser.

Adds a pushback mechanism to not read faster from a serial bridge
than how fast the stack, or a CAN-bus output can sink packets.
This is especially important for USBSerial inputs, which can supply
data as fast as we are willing to read it.

The implementation relies on two mechanisms:
- setting the gridconnect converter to keep track of the CAN frames and only let
  a fixed number of them (5) exist at any time in the CAN hub.
- adding a notifiable to the SerialBridge that keep track of the last txt buffer
  we sent to the gridconnect bridge. We do not read more bytes from the serial
  port in the read loop until the previous buffer is processed by the gridconnect parser.
@balazsracz balazsracz requested a review from atanisoft November 12, 2023 10:41
arduino/OpenMRNLite.h Outdated Show resolved Hide resolved
@balazsracz balazsracz merged commit 6c19d9a into master Dec 3, 2023
8 checks passed
@balazsracz balazsracz deleted the bracz-arduino-read-pushback branch December 3, 2023 10:34
balazsracz added a commit that referenced this pull request Dec 3, 2023
* master:
  Ensures that 'make clean' empties lib directory of symlinks. (#753)
  Add an input/output GPIO type. This helps support bit banged I2C. (#752)
  Adds TinyUsb based CDC virtual Com port driver with an STM32 port. (#748)
  Limit the amount of input we read into memory in arduino sketches. (#746)
  Updates to send_datagram cmdline utility (#740)
balazsracz added a commit that referenced this pull request Dec 3, 2023
* bracz-lib-clean:
  Ensures that 'make clean' empties lib directory of symlinks. (#753)
  Add an input/output GPIO type. This helps support bit banged I2C. (#752)
  Adds TinyUsb based CDC virtual Com port driver with an STM32 port. (#748)
  Limit the amount of input we read into memory in arduino sketches. (#746)
  Updates to send_datagram cmdline utility (#740)
balazsracz added a commit that referenced this pull request Dec 23, 2023
…t-hub-router

* 'master' of github.com:bakerstu/openmrn: (152 commits)
  Switches over make tests at toplevel to use the tests target instead of the cov target.
  Ensures that openmrn and application directory builds can run in parallel. (#754)
  Ensures that 'make clean' empties lib directory of symlinks. (#753)
  Add an input/output GPIO type. This helps support bit banged I2C. (#752)
  Adds TinyUsb based CDC virtual Com port driver with an STM32 port. (#748)
  Limit the amount of input we read into memory in arduino sketches. (#746)
  Updates to send_datagram cmdline utility (#740)
  Adds lflash command to the bracz-railcom board support makefile.
  Do not crash on an incoming message with 0 alias. (#751)
  Add common app test coverage rules. (#750)
  Fix symlinking of library files to the lib directory. (#747)
  Refactors the SPIFFS flash driver for the F7 into a generic stm32 flash driver. (#742)
  Unaligned read/write support in TivaEEPROM storage (#741)
  Adds support for producer/consumer identified message in the CallbackEventHandler. (#743)
  Improve error handling in BroadcastTimeDefs::string_to_date() (#745)
  Fix test makefiles and test target (#736)
  Moves the bootloader hook so that the hook implementation gets a chance to look at incoming frames.
  Fixes missing includes.
  Fixes missing symbol error.
  Adds stm32f072 HAL drivers to bare.armv6m compilation target.
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants