Closed BjarneBitscrambler closed 3 years ago
With commit hash 59b4706 now have the output streams passed to the low-level code as pointers. Main.cc
calls sensor_fusion->InitializeControlSubsystem()
with two optional parameters that specify the serial stream (usually &Serial) and the TCP client socket. Any unused stream is set to NULL and not used.
The #ifdef - #endif brackets around code blocks for serial and WiFi output have been retained however. In build.h
there are two defines, for F_USE_WIRELESS_UART
and F_USE_WIRED_UART
, which control whether these code blocks are compiled or not. There is some memory savings available if not using a stream, and this is felt useful enough to retain this feature. There is no harm (other than increased memory use) in keeping these two defines, and just controlling the stream output in main.cc
Currently the fusion code can output results and accept commands via the Serial object and via TCP socket. These are selected using some inelegant #ifdef - #endif brackets around multiple code sections in multiple places.
It's preferred to implement something that at the lower level would accept a stream pointer of arbitrary type and use it for input/output. The main.cc code could then instantiate whatever type of stream was needed.