Skip to content

Commit b0d7cfb

Browse files
danielcharruadni
andauthored
Add serial config (#18)
* added gitignore * fix serial config portal --------- Co-authored-by: dni ⚡ <[email protected]>
1 parent 0130764 commit b0d7cfb

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
installer/main_assets
22
installer/firmware
33
.pio
4+
.DS_Store
45
.vscode
56
dist
67
build

bitcoinSwitch/bitcoinSwitch.ino

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@ bool down = false;
4040
long thresholdSum = 0;
4141
long payment_amount = 0;
4242

43+
// Serial config
44+
int portalPin = 4;
45+
4346
WebSocketsClient webSocket;
4447

4548
struct KeyValue {
@@ -51,6 +54,25 @@ void setup()
5154
{
5255
Serial.begin(115200);
5356
pinMode (2, OUTPUT); // To blink on board LED
57+
58+
int timer = 0;
59+
while (timer < 2000)
60+
{
61+
digitalWrite(2, HIGH);
62+
Serial.println(touchRead(portalPin));
63+
if (touchRead(portalPin) < 60)
64+
{
65+
Serial.println("Launch serial config");
66+
configOverSerialPort();
67+
timer = 5000;
68+
}
69+
70+
timer = timer + 100;
71+
delay(150);
72+
digitalWrite(2, LOW);
73+
delay(150);
74+
}
75+
5476
FlashFS.begin(FORMAT_ON_FAIL);
5577
readFiles(); // get the saved details and store in global variables
5678
WiFi.begin(ssid.c_str(), wifiPassword.c_str());

0 commit comments

Comments
 (0)