for some applications, it is necessary (or highly convenient) to have the serial buffer sizes different to the default sizes. to achieve this, the user has to modify the contents of the HardwareSerial.h file in ...\hardware\arduino\avr\cores\arduino. however, it is undesirable to have the (potentially inexperienced) user tinkering with these files.
i would like to propose the following solution be implemented, to allow the user to alter the serial buffer sizes:
1. in HardwareSerial.h add in the following single (bolded) line:
#if (RAMEND < 1000)
#define SERIAL_TX_BUFFER_SIZE 16
#define SERIAL_RX_BUFFER_SIZE 16
#else
#define SERIAL_TX_BUFFER_SIZE 64
#define SERIAL_RX_BUFFER_SIZE 64
#endif
#include "OVERRIDE\serial_buffer_size.h" // ##### override default buffer size #####
#endif
2. create a subdirectory ...\hardware\arduino\avr\cores\arduino\OVERRIDE
3. in that subdirectory create a zero-length file called serial_buffer_size.h
the above three steps provide a safe location where (a) a user can override default settings, which can (b) easily be restored to 'factory default' by truncating the files back to zero length, all without (c) altering existing functionality or compiler output provided step 3. holds. in principal the same method could be used to allow for overriding other settings on other core libraries.
i would then like to suggest that the following IDE changes could be made to facilitate using the above provisions:
4. to the Arduino IDE add an entry under the "Tools" menu called "OVERRIDES" where the user can select any settings that they wish to override, and select amongst safe override values. for instance, there may be Tools -> OVERRIDES -> Serial RX Buffer Size with options of 'default', '16', '64', '256', '1024' (and the same for Serial TX Buffer Size).
what do the developers think of this idea? steps 1 to 3 could initially be carried out with minimal effort (i have tested out steps 1 to 3 and verified they work as desired), with step 4 (or some variation thereof) implemented later on. overrides could be provided as global irrespective of the board selected, or made specific to only one board or type of processor.
i would much appreciate feedback.
cheers,
rob :-)