Serial control enabled

This commit is contained in:
Ollo 2024-12-06 22:53:34 +01:00
parent f761d3349e
commit 365d8c987a

View File

@ -5,6 +5,8 @@
#include <Adafruit_NeoPixel.h> #include <Adafruit_NeoPixel.h>
#include "ColorUtil.h" #include "ColorUtil.h"
#include "controller.h" #include "controller.h"
#include "SerialCmd.h"
/****************************************************************************** /******************************************************************************
* MACROS * MACROS
******************************************************************************/ ******************************************************************************/
@ -78,6 +80,9 @@ void setup()
{ {
Serial.println(F("\nWifi mode is WIFI_OFF")); Serial.println(F("\nWifi mode is WIFI_OFF"));
} }
SerialCmd_clearCmdArray();
#ifdef FAN_ENABLED #ifdef FAN_ENABLED
/* Setup FAN Control */ /* Setup FAN Control */
pinMode(FAN_PIN, OUTPUT); pinMode(FAN_PIN, OUTPUT);
@ -170,9 +175,31 @@ void loop()
i = 0; i = 0;
} }
pixels->fill(Color(255, 0,0)); int readCharacter = SerialCmd_readFromSerial();
pixels->setBrightness(actualFanSpeedRpm);
if (readCharacter > 0)
{
int checkCmd = SerialCmd_checkCmdArrayForPrefix();
if(checkCmd == 0)
{
Serial.println("if you dont know what to do type \"ollpehelp\"");
}
else
{
char type = SerialCmd_type();
switch (type)
{
case 'a':
uint32_t color = SerialCmd_parseColor(6);
pixels->fill(color);
pixels->setBrightness(200);
break;
}
}
}
pixels->show(); pixels->show();
#else #else
RainbowCycle(pixels, &mRainbowIndex); RainbowCycle(pixels, &mRainbowIndex);
Serial.print(mRainbowIndex); Serial.print(mRainbowIndex);