aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGabriel Marcano <[email protected]>2024-12-22 22:54:38 -0800
committerGabriel Marcano <[email protected]>2024-12-22 23:33:21 -0800
commitb2578512e5b8476021d0a5eb6392d1bfc6c691b5 (patch)
tree294734e1f2dff1046b7b4b17f7c2ae6ca95085b1
parent1a16fcf875709846f98d38410fb37a6d1b32a062 (diff)
downloadcartreader-b2578512e5b8476021d0a5eb6392d1bfc6c691b5.tar.gz
cartreader-b2578512e5b8476021d0a5eb6392d1bfc6c691b5.zip
Update Cart_Reader.ino
- Remove incomingByte global variable, mark all uses as local variables. This leads to a tiny (yet measurable) decrease in global variable use, and no change in sketch memory use. Of course, the variable now resides in the stack, but only while the functions using it exist, which isn't always.
-rw-r--r--Cart_Reader/Cart_Reader.ino11
1 files changed, 3 insertions, 8 deletions
diff --git a/Cart_Reader/Cart_Reader.ino b/Cart_Reader/Cart_Reader.ino
index 2ee979c..1dc7f44 100644
--- a/Cart_Reader/Cart_Reader.ino
+++ b/Cart_Reader/Cart_Reader.ino
@@ -267,11 +267,6 @@ boolean holdEventPast2 = false; // whether or not the hold event happened a
boolean longholdEventPast2 = false; // whether or not the long hold event happened already
#endif
-#ifdef ENABLE_SERIAL
-// For incoming serial data
-int incomingByte;
-#endif
-
// Variables for the menu
int choice = 0;
// Temporary array that holds the menu option read out of progmem
@@ -2955,7 +2950,7 @@ byte questionBox_Serial(const __FlashStringHelper* question __attribute__((unuse
}
// Read the incoming byte:
- incomingByte = Serial.read() - 48;
+ int incomingByte = Serial.read() - 48;
// Page up (u)
if (incomingByte == 69) {
@@ -3197,7 +3192,7 @@ void checkUpdater() {
uint8_t checkButton() {
while (Serial.available() == 0) {
}
- incomingByte = Serial.read() - 48;
+ int incomingByte = Serial.read() - 48;
//Next
if (incomingByte == 52) {
@@ -3223,7 +3218,7 @@ void wait_serial() {
}
while (Serial.available() == 0) {
}
- incomingByte = Serial.read() - 48;
+ int incomingByte = Serial.read() - 48;
/* if ((incomingByte == 53) && (fileName[0] != '\0')) {
// Open file on sd card
sd.chdir(folder);