Skip to content

Commit 1b6b445

Browse files
committed
update packet response size to allow for possible bad request content
1 parent 60fd949 commit 1b6b445

File tree

3 files changed

+11
-7
lines changed

3 files changed

+11
-7
lines changed

SolArduino_atom/SolArduino/SolArduino.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
const int TABLE_LENGTH = 10; // declare length here is easier
88
int angles[TABLE_LENGTH]; //stores angles*10
99
long dates[TABLE_LENGTH]; //stores unix times
10-
const int TABLE_SIZE = 400; //this many bytes for 10 angles will do, used in ethernet buffer and when parsing
10+
const int TABLE_SIZE = 600; //was 400, increased to allow bad request content to show. This many bytes for 10 angles will do, used in ethernet buffer and when parsing
1111
int tableIndex = 0; // The current index in the table when in auto mode
1212

1313
//pin declarations

SolArduino_atom/SolArduino/communication.ino

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -114,23 +114,27 @@ void parseString(char *from) {
114114
char dateString[120]; //these may need some tuning
115115
char angleString[60];
116116

117-
// Serial.print(F("free ram after assignments: "));
118-
// Serial.println(freeRam());
117+
// Serial.print(F("free ram after assignments: "));
118+
// Serial.println(freeRam());
119119

120+
// Debug received response, look for html response code
121+
Serial.println(from);
122+
120123
found = strtok(from, "_");
121124
int i = 0;
122125
while(found != NULL){
123126

127+
// First, split into three pieces: number of angles, string with dates, string with angles
124128
if(i==1){
125129
if (TABLE_LENGTH != atoi(found)) {
126130
Serial.println(F("WARNING length of received values does not match local array length"));
127-
EmergencyState = "Length mismatch";
131+
EmergencyState = F("Length mismatch");
128132
}
129133
} else if(i==2) {
130134
strcpy(dateString,found);
131-
// Serial.println(found);
135+
// Serial.println(found);
132136
} else if(i==3) {
133-
// Serial.println(found);
137+
// Serial.println(found);
134138
strcpy(angleString,found);
135139
}
136140
found = strtok(NULL, "_"); //extract next token

SolArduino_atom/SolArduino/solarPanelControl.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ void solarPanelUp() {
152152

153153
void solarPanelStop() {
154154
panelsStopped = true;
155-
Serial.println(F("Panels stopped"));
155+
// Serial.println(F("Panels stopped"));
156156
digitalWrite(POWER_LOW, LOW);
157157
digitalWrite(POWER_HIGH, LOW);
158158
digitalWrite(DIRECTION_PIN, LOW);

0 commit comments

Comments
 (0)