Fixed off by one error and updated readme

This commit is contained in:
2024-10-29 19:54:41 -04:00
parent a5652102a0
commit 331cbe4f82
3 changed files with 30 additions and 57 deletions

View File

@@ -127,55 +127,6 @@ Format Example `!3;`
Description: This command will tell the ESP32 to re-enable its idle animation. It will respond with a `!3;` when it recieves this command.
**HERE IS A GUIDE TO GET YOU STARTED ON YOUR [MAYBE] FIRST REPOSITORY**:
<https://docs.codeberg.org/getting-started/first-repository/#2.-clone-the-repository>
Obviously, this is not what your README should say on-submission. Change it. Yes, the whole thing.
This is where a description of your project will go. README.md files support [Markdown syntax](https://www.markdownguide.org/basic-syntax/).
## Setup
**Oh yeah, by the way, don't forget to set up `git lfs` on your machine.**
Tell everyone what your project needs in order to run. This might involve many components or software. Maybe some cool libraries?
### Hardware Required
- Some polyphonic headset on OS version `3.14159265358979323846233832795028841971` with room-temperature hyperconductors
- Some macrocontroller with specific hardware revision `4.2`
- With tank wheels
- Some computer with a holoported underdisplay cap
- Some fancy smart device that is worn and knows your favorite toothpaste
### Software Dependencies
- Division Game Engine version `2024.1.26`
- Michaelsoft Binbows `XD`
## Run
1. Open the thing
- You know, that thing over there
- No, not that one
- Go back
- Yes, that one
2. Click the button and type the following text:
```shell
# install the sotware
sudo apt install -y cmatrix
# run the trap
cmatrix
```
3. After the process completes and you don't even see the code, anymore, you are ready. Here is what it looks like:
```js
"b" + "a" + +"a" + "a"; // 'baNaNa'
```
## Shout-Outs
- Thank you to all the organizers at Reality Hack and the Hardware track.
- Lucas De Bonet for creating `the Singularity` which allowed us to connect the board to Quest headsets.

View File

@@ -133,7 +133,10 @@ void BoardManager<BOARD_DIMS>::Update(){
// create a cube slice array buffer
BOARD_TYPES::Cube* sliceBuffer[BOARD_DIMS.z];
// have the board slice get read into our buffer
this->board.SliceBoard(sliceVector, sliceBuffer);
uint32_t sliceSize = this->board.SliceBoard(sliceVector, sliceBuffer);
if(sliceSize < BOARD_DIMS.z){
return;
}
// send the board slice to the driver to update its LED colors
this->driver.UpdateStackLEDs(stackIndex, sliceBuffer, BOARD_DIMS.z);
}
@@ -146,9 +149,14 @@ void BoardManager<BOARD_DIMS>::updateStackColors(const V3D<uint32_t> &column){
V3D<uint32_t> sliceVector{column.x, column.y, BOARD_TYPES::Z};
// create a buffer for slice board to write the cube slice into
BOARD_TYPES::Cube * cubeSlice[BOARD_DIMS.z];
this->board.SliceBoard(column, cubeSlice);
uint32_t sliceSize = this->board.SliceBoard(column, cubeSlice);
uint32_t numCubes{this->getColumnHeight(static_cast<BOARD_TYPES::PLANE_NORMAL>(column.z))};
if(sliceSize < numCubes){
return;
}
this->driver.UpdateStackLEDs(BOARD_DIMS.x, cubeSlice, numCubes);
}
@@ -168,6 +176,11 @@ void BoardManager<BOARD_DIMS>::SetColumnColors(const V3D<uint32_t> &column, cons
uint32_t sliceLength{this->board.SliceBoard(column, slicedBoard)};
uint32_t maxIndex{std::min(numColors, columnHeight)};
if(sliceLength < maxIndex){
return;
}
for(uint32_t i = 0; i < maxIndex; i++){
slicedBoard[i]->color = color[i];
}

View File

@@ -85,21 +85,30 @@ void printBoardState(){
}
void SetStackColor(uint32_t * args, uint32_t argsLength){
uint32_t stackNum = args[1];
uint32_t stackNum = args[0];
uint32_t X_COORD{stackNum};
while(X_COORD > BOARD_DIMENSIONS.x - 1){
X_COORD -= BOARD_DIMENSIONS.x;
}
uint32_t Y_COORD{(stackNum - X_COORD) / BOARD_DIMENSIONS.y};
Serial.println("StackNum: " + String(stackNum));
Serial.println("X: " + String(X_COORD) + " Y: " + String(Y_COORD));
uint32_t numColors = (argsLength - 1) / 3;
uint32_t numColors = (argsLength - 2) / 3;
// nothing to do if no colors were given
if(numColors == 0){
return;
}
Serial.println("Num Colors: " + String(numColors));
V3D<uint32_t> colors[numColors];
for(int i = 0; i < numColors; i++){
uint32_t red = args[2 + (i * 3)];
uint32_t green = args[3 + (i * 3)];
uint32_t blue = args[4 + (i * 3)];
uint32_t red = args[1 + (i * 3)];
uint32_t green = args[2 + (i * 3)];
uint32_t blue = args[3 + (i * 3)];
colors[i] = V3D<uint32_t>{red, green, blue};
Serial.println("Color: " + String(red) + "," + String(green) + "," + String(blue));
}
boardManager.SetColumnColors(V3D<uint32_t>{X_COORD, Y_COORD, BOARD_TYPES::PLANE_NORMAL::Z}, colors, numColors);
}
@@ -120,7 +129,7 @@ CommandHandler::CommandStatus SetColorCommandHandler(uint32_t * args, uint32_t a
animator.isEnabled = false;
V3D<uint32_t> black{};
boardManager.FillColor(black);
SetStackColor(reinterpret_cast<uint32_t *>(args), argsLength);
SetStackColor(args, argsLength);
return CommandHandler::CommandStatus::SUCCESS;
}