Compare commits
No commits in common. "d61e0fb40f44573bbdac545dcc0456e0fe46f3c8" and "c141a38e9c078e5b9ef1a0e697525faf662c3e08" have entirely different histories.
d61e0fb40f
...
c141a38e9c
@ -38,13 +38,6 @@ A compiled "release" will be done once I finish somoe fo the basic features, but
|
|||||||
# Connecting to WiFi
|
# Connecting to WiFi
|
||||||
The device will scan for WiFi networks on boot. Once the list is displayed, you can scroll up and down the list with the "u" key for UP and the "d" key for down.
|
The device will scan for WiFi networks on boot. Once the list is displayed, you can scroll up and down the list with the "u" key for UP and the "d" key for down.
|
||||||
|
|
||||||
# Commands
|
|
||||||
| Command | Description |
|
|
||||||
| --------------- | --------------------------- |
|
|
||||||
| `/debug` | Show hardware information |
|
|
||||||
| `/me <message>` | Send an ACTION message |
|
|
||||||
| `/raw <data>` | Send RAW data to the server |
|
|
||||||
|
|
||||||
# Debugging over Serial
|
# Debugging over Serial
|
||||||
1. Install screen: `apt-get install screen` *(or whatever package manager you use)*
|
1. Install screen: `apt-get install screen` *(or whatever package manager you use)*
|
||||||
2. Plug in your device via USB.
|
2. Plug in your device via USB.
|
||||||
|
41
src/main.ino
41
src/main.ino
@ -21,8 +21,8 @@
|
|||||||
#define MAX_LINES ((SCREEN_HEIGHT - INPUT_LINE_HEIGHT - STATUS_BAR_HEIGHT) / (CHAR_HEIGHT + LINE_SPACING))
|
#define MAX_LINES ((SCREEN_HEIGHT - INPUT_LINE_HEIGHT - STATUS_BAR_HEIGHT) / (CHAR_HEIGHT + LINE_SPACING))
|
||||||
|
|
||||||
#define BOARD_BAT_ADC 4 // Define the ADC pin used for battery reading
|
#define BOARD_BAT_ADC 4 // Define the ADC pin used for battery reading
|
||||||
#define CONV_FACTOR 1.8 // Conversion factor for the ADC to voltage conversion
|
#define CONV_FACTOR 1.8 // Conversion factor for the ADC to voltage conversion
|
||||||
#define READS 20 // Number of readings for averaging
|
#define READS 20 // Number of readings for averaging
|
||||||
Pangodream_18650_CL BL(BOARD_BAT_ADC, CONV_FACTOR, READS);
|
Pangodream_18650_CL BL(BOARD_BAT_ADC, CONV_FACTOR, READS);
|
||||||
|
|
||||||
TFT_eSPI tft = TFT_eSPI();
|
TFT_eSPI tft = TFT_eSPI();
|
||||||
@ -298,19 +298,6 @@ void displayLines() {
|
|||||||
String modeChange = line.substring(5);
|
String modeChange = line.substring(5);
|
||||||
tft.setTextColor(TFT_WHITE);
|
tft.setTextColor(TFT_WHITE);
|
||||||
tft.print(modeChange);
|
tft.print(modeChange);
|
||||||
cursorY += CHAR_HEIGHT;
|
|
||||||
} else if (line.startsWith("* ")) { // Check for action message
|
|
||||||
int spacePos = line.indexOf(' ', 2);
|
|
||||||
String senderNick = line.substring(2, spacePos);
|
|
||||||
String actionMessage = line.substring(spacePos + 1);
|
|
||||||
|
|
||||||
tft.setTextColor(TFT_WHITE);
|
|
||||||
tft.print("* ");
|
|
||||||
tft.setTextColor(nickColors[senderNick]);
|
|
||||||
tft.print(senderNick + " ");
|
|
||||||
tft.setTextColor(TFT_WHITE);
|
|
||||||
tft.print(actionMessage);
|
|
||||||
|
|
||||||
cursorY += CHAR_HEIGHT;
|
cursorY += CHAR_HEIGHT;
|
||||||
} else {
|
} else {
|
||||||
int colonPos = line.indexOf(':');
|
int colonPos = line.indexOf(':');
|
||||||
@ -334,7 +321,6 @@ void displayLines() {
|
|||||||
displayInputLine();
|
displayInputLine();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void addLine(String senderNick, String message, String type, bool mention = false) {
|
void addLine(String senderNick, String message, String type, bool mention = false) {
|
||||||
if (nickColors.find(senderNick) == nickColors.end())
|
if (nickColors.find(senderNick) == nickColors.end())
|
||||||
nickColors[senderNick] = generateRandomColor();
|
nickColors[senderNick] = generateRandomColor();
|
||||||
@ -358,8 +344,6 @@ void addLine(String senderNick, String message, String type, bool mention = fals
|
|||||||
formattedMessage = "KICK " + senderNick + message;
|
formattedMessage = "KICK " + senderNick + message;
|
||||||
} else if (type == "mode") {
|
} else if (type == "mode") {
|
||||||
formattedMessage = "MODE " + message;
|
formattedMessage = "MODE " + message;
|
||||||
} else if (type == "action") {
|
|
||||||
formattedMessage = "* " + senderNick + " " + message;
|
|
||||||
} else {
|
} else {
|
||||||
formattedMessage = senderNick + ": " + message;
|
formattedMessage = senderNick + ": " + message;
|
||||||
}
|
}
|
||||||
@ -377,7 +361,6 @@ void addLine(String senderNick, String message, String type, bool mention = fals
|
|||||||
displayLines();
|
displayLines();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void displayDeviceInfo() {
|
void displayDeviceInfo() {
|
||||||
tft.fillScreen(TFT_BLACK);
|
tft.fillScreen(TFT_BLACK);
|
||||||
printDeviceInfo();
|
printDeviceInfo();
|
||||||
@ -527,14 +510,7 @@ void parseAndDisplay(String line) {
|
|||||||
String message = line.substring(colonPos + 1);
|
String message = line.substring(colonPos + 1);
|
||||||
String senderNick = line.substring(1, line.indexOf('!'));
|
String senderNick = line.substring(1, line.indexOf('!'));
|
||||||
bool mention = message.indexOf(nick) != -1;
|
bool mention = message.indexOf(nick) != -1;
|
||||||
|
addLine(senderNick, message, "message", mention);
|
||||||
// This doesn't work for some annoying reason... even with \001
|
|
||||||
if (message.startsWith("\x01ACTION ") && message.endsWith("\x01")) {
|
|
||||||
String actionMessage = message.substring(8, message.length() - 1);
|
|
||||||
addLine(senderNick, actionMessage, "action");
|
|
||||||
} else {
|
|
||||||
addLine(senderNick, message, "message", mention);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else if (command == "JOIN" && line.indexOf(channel) != -1) {
|
} else if (command == "JOIN" && line.indexOf(channel) != -1) {
|
||||||
String senderNick = line.substring(1, line.indexOf('!'));
|
String senderNick = line.substring(1, line.indexOf('!'));
|
||||||
@ -562,8 +538,6 @@ void parseAndDisplay(String line) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void handleKeyboardInput(char key) {
|
void handleKeyboardInput(char key) {
|
||||||
if (key == '\n' || key == '\r') { // Enter
|
if (key == '\n' || key == '\r') { // Enter
|
||||||
if (inputBuffer.startsWith("/debug")) {
|
if (inputBuffer.startsWith("/debug")) {
|
||||||
@ -574,11 +548,6 @@ void handleKeyboardInput(char key) {
|
|||||||
} else if (inputBuffer.startsWith("/raw ")) {
|
} else if (inputBuffer.startsWith("/raw ")) {
|
||||||
String rawCommand = inputBuffer.substring(5);
|
String rawCommand = inputBuffer.substring(5);
|
||||||
sendRawCommand(rawCommand);
|
sendRawCommand(rawCommand);
|
||||||
} else if (inputBuffer.startsWith("/me ")) {
|
|
||||||
String actionMessage = inputBuffer.substring(4);
|
|
||||||
sendIRC("PRIVMSG " + String(channel) + " :\001ACTION " + actionMessage + "\001");
|
|
||||||
addLine(nick, actionMessage, "action");
|
|
||||||
inputBuffer = "";
|
|
||||||
} else {
|
} else {
|
||||||
sendIRC("PRIVMSG " + String(channel) + " :" + inputBuffer);
|
sendIRC("PRIVMSG " + String(channel) + " :" + inputBuffer);
|
||||||
addLine(nick, inputBuffer, "message");
|
addLine(nick, inputBuffer, "message");
|
||||||
@ -923,7 +892,9 @@ void printDeviceInfo() {
|
|||||||
uint32_t chipId = ESP.getEfuseMac(); // Unique ID
|
uint32_t chipId = ESP.getEfuseMac(); // Unique ID
|
||||||
esp_chip_info_t chip_info;
|
esp_chip_info_t chip_info;
|
||||||
esp_chip_info(&chip_info);
|
esp_chip_info(&chip_info);
|
||||||
String chipInfo = String(chip_info.model) + " Rev " + String(chip_info.revision) + ", " + String(chip_info.cores) + " cores, " + String(ESP.getCpuFreqMHz()) + " MHz";
|
String chipInfo = String(chip_info.model) + " Rev " + String(chip_info.revision) +
|
||||||
|
", " + String(chip_info.cores) + " cores, " +
|
||||||
|
String(ESP.getCpuFreqMHz()) + " MHz";
|
||||||
|
|
||||||
// Get Flash Info
|
// Get Flash Info
|
||||||
size_t flashSize = spi_flash_get_chip_size();
|
size_t flashSize = spi_flash_get_chip_size();
|
||||||
|
Loading…
Reference in New Issue
Block a user