@@ -9,7 +9,8 @@ int config_threshold_amount;
99int config_threshold_pin;
1010int config_threshold_time;
1111
12- String apiUrl = " /api/v1/ws/" ;
12+ int ledPin;
13+
1314
1415// length of switch device id
1516// 7dhdyJ9bbZNWNVPiFSdmb5
@@ -30,8 +31,6 @@ void setup() {
3031 setupConfig ();
3132 setupWifi ();
3233
33- pinMode (2 , OUTPUT); // To blink on board LED
34-
3534 if (config_device_string == " " ) {
3635 Serial.println (" No device string configured!" );
3736 printTFT (" No device string!" , 21 , 95 );
@@ -52,8 +51,8 @@ void setup() {
5251
5352 if (config_threshold_amount != 0 ) { // Use in threshold mode
5453 Serial.println (" Using THRESHOLD mode" );
55- Serial.println (" Connecting to websocket: " + host + apiUrl + config_threshold_inkey);
56- webSocket.beginSSL (host, 443 , apiUrl + config_threshold_inkey);
54+ Serial.println (" Connecting to websocket: " + host + apiPath + config_threshold_inkey);
55+ webSocket.beginSSL (host, 443 , apiPath + config_threshold_inkey);
5756 } else { // Use in normal mode
5857 Serial.println (" Using NORMAL mode" );
5958 Serial.println (" Connecting to websocket: " + host + apiPath);
@@ -91,7 +90,7 @@ void executePayment(uint8_t *payload) {
9190 }
9291 Serial.println (" [WebSocket] received pin: " + String (pin) + " , duration: " + String (time));
9392
94- if (config_threshold_amount != 0 ) {
93+ if (config_threshold_amount > 0 ) {
9594 // If in threshold mode we check the "balance" pushed by the
9695 // websocket and use the pin/time preset
9796 // executeThreshold();
@@ -100,9 +99,13 @@ void executePayment(uint8_t *payload) {
10099
101100 // the magic happens here
102101 pinMode (pin, OUTPUT);
102+ pinMode (ledPin, OUTPUT);
103+
103104 digitalWrite (pin, HIGH);
105+ digitalWrite (ledPin, HIGH);
104106 delay (time);
105107 digitalWrite (pin, LOW);
108+ digitalWrite (ledPin, LOW);
106109
107110 printHome (true , true , false );
108111
0 commit comments