-
-
Notifications
You must be signed in to change notification settings - Fork 215
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'pr3y:main' into cleanup-2
- Loading branch information
Showing
6 changed files
with
78 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
# Bruce PCB | ||
# Bruce M5stick extender v0.1 | ||
|
||
This PCB was designed by TH3_KR4K3N | ||
|
||
![KR4K3N Bruce PCB front](https://raw.githubusercontent.com/pr3y/Bruce/refs/heads/main/media/pcbs/TH3_KR4K3N/pcb_back.jpg) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,7 @@ | ||
# Bruce PCB | ||
# Bruce M5 Stick Extender | ||
|
||
This PCB was designed by ultramarines | ||
|
||
![ultramarines Bruce PCB side](https://raw.githubusercontent.com/pr3y/Bruce/refs/heads/main/media/pcbs/ultramarines/ultramarines_full_side.jpg) | ||
![ultramarines Bruce PCB front](https://raw.githubusercontent.com/pr3y/Bruce/refs/heads/main/media/pcbs/ultramarines/ultramarines_pcb_front.png) | ||
![ultramarines Bruce PCB back](https://raw.githubusercontent.com/pr3y/Bruce/refs/heads/main/media/pcbs/ultramarines/ultramarines_pcb_back.jpg) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
#include "modules/wifi/listenTCP.h" | ||
#include "core/wifi_common.h" | ||
|
||
void listenTcpPort() { | ||
if (!wifiConnected) wifiConnectMenu(); | ||
|
||
WiFiClient tcpClient; | ||
tft.fillScreen(TFT_BLACK); | ||
tft.setTextSize(1); | ||
tft.setTextColor(TFT_WHITE, TFT_BLACK); | ||
|
||
String portNumber = keyboard("", 5, "TCP port to listen"); | ||
int portNumberInt = atoi(portNumber.c_str()); | ||
|
||
WiFiServer tcpServer(portNumberInt); | ||
tcpServer.begin(); | ||
|
||
tft.println("Listening..."); | ||
tft.print(WiFi.localIP().toString().c_str()); | ||
tft.println(":" + portNumber); | ||
|
||
bool inputMode; | ||
|
||
for (;;) { | ||
WiFiClient client = tcpServer.available(); // Wait for a client to connect | ||
|
||
if (client) { | ||
Serial.println("Client connected"); | ||
tft.println("Client connected"); | ||
|
||
while (client.connected()) { | ||
if (inputMode) { | ||
String keyString = keyboard("", 16, "send input data"); | ||
delay(300); | ||
inputMode = false; | ||
tft.fillScreen(TFT_BLACK); | ||
tft.setCursor(0,0); | ||
if (keyString.length() > 0) { | ||
client.print(keyString); // Send the entire string to the client | ||
Serial.print(keyString); | ||
} | ||
} else { | ||
if (client.available()) { | ||
char incomingChar = client.read(); // Read one byte at time from the client | ||
tft.print(incomingChar); | ||
Serial.print(incomingChar); | ||
} | ||
if (checkSelPress()) { | ||
delay(300); | ||
inputMode = true; | ||
} | ||
} | ||
} | ||
client.stop(); | ||
Serial.println("Client disconnected"); | ||
displayError("Client disconnected"); | ||
|
||
} | ||
if (checkEscPress()) { | ||
displayError("Exiting Listener"); | ||
tcpServer.stop(); | ||
break; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#include "core/mykeyboard.h" | ||
|
||
void listenTcpPort(); |