Skip to content

Commit e584b8d

Browse files
committed
fix serial port detection and report it in godmode
1 parent 28c305d commit e584b8d

File tree

3 files changed

+14
-7
lines changed

3 files changed

+14
-7
lines changed

cpp/arduino/ArduinoDefines.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,4 +87,3 @@
8787
#define TIMER5B 17
8888
#define TIMER5C 18
8989

90-
#include "include/io.h"

cpp/arduino/Godmode.h

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#pragma once
22
#include "ArduinoDefines.h"
3+
#include <avr/io.h>
34
#include "WString.h"
45

56
#define MOCK_PINS_COUNT 256
@@ -49,14 +50,21 @@ class GodmodeState {
4950
seed = 1;
5051
}
5152

52-
GodmodeState() {
53+
int serialPorts() {
54+
return NUM_SERIAL_PORTS;
55+
}
56+
57+
58+
GodmodeState()
59+
{
5360
reset();
54-
for (int i = 0; i < NUM_SERIAL_PORTS; ++i) {
55-
serialPort[i].dataIn = "";
56-
serialPort[i].dataOut = "";
61+
for (int i = 0; i < serialPorts(); ++i)
62+
{
63+
serialPort[i].dataIn = "";
64+
serialPort[i].dataOut = "";
5765
serialPort[i].readDelayMicros = 0;
5866
}
59-
}
67+
}
6068

6169
};
6270

cpp/arduino/WString.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class String: public string
2323

2424
private:
2525
static const char* digit(int val) {
26-
const char* bank = "0123456789ABCDEF";
26+
static const char* bank = "0123456789ABCDEF";
2727
return bank + val;
2828
}
2929

0 commit comments

Comments
 (0)