Disabled serial classic and changed serial baudrate to be compatible with bluetooth classic adapter

This commit is contained in:
2024-06-01 11:31:56 -04:00
parent 20a7aef333
commit a4fdf53259
6 changed files with 3721 additions and 33 deletions

2
.gitignore vendored
View File

@@ -1,6 +1,6 @@
.pio
.vscode
*.kicad_pcb.lck
*.lck
Schematics/Block-Party/Block-Party-Main-Board/production/
Schematics/Block-Party/Block-Party-Cube-Top-Board/production

View File

@@ -3573,7 +3573,7 @@
(hide yes)
)
)
(property "Manufacturer_Part_Number" "XINGLIGHT XL-1615RGBC-WS2812B"
(property "Manufacturer_Part_Number" "Quinn_lib:XL-1615RGBC-WS2812B"
(at 144.78 85.09 0)
(effects
(font

View File

@@ -1 +0,0 @@
{"hostname":"THE-OBELISK","username":"Quinn"}

View File

@@ -7,22 +7,33 @@
;
; Please visit documentation for the other options and examples
; https://docs.platformio.org/page/projectconf.html
[platformio]
default_envs = esp32s3_release ; this ensures that only this environment is built for anything but the debug build
[env]
platform = espressif32
; platform = espressif32
upload_protocol = esptool
platform = https://github.com/platformio/platform-espressif32.git
board = esp32-s3-devkitc-1
framework = arduino
build_flags = -Iinclude
; lib_ldf_mode = chain+
monitor_speed = 115200
monitor_filters = esp32_exception_decoder, colorize, send_on_enter
upload_speed = 2000000 ;ESP32S3 USB-Serial Converter maximum 2000000bps
lib_deps = adafruit/Adafruit NeoPixel@^1.12.0
[env:esp32-s3-debug]
board = adafruit_feather_esp32s3_nopsram
build_type = debug
build_flags = -D DEBUG
[env:esp32-s3-build]
board = adafruit_feather_esp32s3_nopsram
build_flags = -D RELEASE
[env:esp32s3_release]
build_type = release
[env:denky32]
board = denky32
[env:esp32s3_debug]
debug_init_break = tbreak setup
debug_tool = esp-builtin
build_type = debug
debug_speed = 20000
; upload_port = COM7
; debug_port = COM7
; monitor_port = COM14
build_flags = -O1 -Iinclude

View File

@@ -3,7 +3,8 @@
#include <BluetoothSerial.h>
// project specific libraries
#include "BluetoothSerialMessage.h"
#include "BluetoothSerial.h"
#include "SerialMessage.h"
#include "BoardLayout.h"
#include "BOARD-DEFINITIONS.h"
#include "Color.h"
@@ -22,8 +23,8 @@ enum Commands : uint8_t{
// --------------------------------------------------
// ------------- OBJECT DEFINITIONS -----------------
// --------------------------------------------------
BluetoothSerial SerialBT;
BluetoothSerialMessage serialMessageBT(&SerialBT);
// BluetoothSerial SerialBT;
// BluetoothSerialMessage serialMessageBT(&SerialBT);
SerialMessage serialMessage(&Serial);
BoardLayout board(BOARD_WIDTH, BOARD_LENGTH, BOARD_HEIGHT, stacks);
@@ -44,20 +45,20 @@ void printBoardState(){
board.GetBoardState(boardState);
Serial.print("!0,");
SerialBT.print("!0,");
// SerialBT.print("!0,");
for(int i = 0; i < (BOARD_WIDTH * BOARD_LENGTH); i++){
Serial.print(boardState[i]);
SerialBT.print(boardState[i]);
// SerialBT.print(boardState[i]);
if(i == (BOARD_WIDTH * BOARD_LENGTH) - 1){
break;
}
Serial.print(",");
SerialBT.print(",");
// SerialBT.print(",");
}
Serial.println(";");
SerialBT.println(";");
// SerialBT.println(";");
}
void setStackColor(int * args, int argsLength){
@@ -85,26 +86,26 @@ void parseData(int * args, int argsLength){
break;
case Commands::PING:
Serial.print("!");
SerialBT.print("!");
// SerialBT.print("!");
Serial.print(Commands::PING);
SerialBT.print(Commands::PING);
// SerialBT.print(Commands::PING);
Serial.println(";");
SerialBT.println(";");
// SerialBT.println(";");
break;
case Commands::SetStackColors:
Serial.println("!2;");
SerialBT.println("!2;");
// SerialBT.println("!2;");
colorManager.Enable(false);
setStackColor(args, argsLength);
break;
case Commands::GoToIdle:
Serial.println("!3;");
SerialBT.println("!3;");
// SerialBT.println("!3;");
colorManager.Enable(true);
break;
default:
Serial.println("INVALID COMMAND");
SerialBT.println("INVALID COMMAND");
// SerialBT.println("INVALID COMMAND");
break;
}
}
@@ -113,8 +114,8 @@ void parseData(int * args, int argsLength){
// ----------------- SETUP AND LOOP -----------------
// --------------------------------------------------
void setup() {
Serial.begin(115200);
SerialBT.begin("blockPartyBT");
Serial.begin(9600);
// SerialBT.begin("blockPartyBT");
Color colors[] = {Color(255, 0, 0), Color(0, 0, 0), Color(0, 0, 0)};
board.SetStackColors(2, colors);
@@ -132,10 +133,10 @@ void loop() {
parseData(serialMessage.GetArgs(), serialMessage.GetArgsLength());
serialMessage.ClearNewData();
}
serialMessageBT.Update();
if(serialMessageBT.IsNewData()){
parseData(serialMessageBT.GetArgs(), serialMessageBT.GetArgsLength());
serialMessageBT.ClearNewData();
}
// serialMessageBT.Update();
// if(serialMessageBT.IsNewData()){
// parseData(serialMessageBT.GetArgs(), serialMessageBT.GetArgsLength());
// serialMessageBT.ClearNewData();
// }
colorManager.Update();
}