Serial control enabled
This commit is contained in:
parent
f761d3349e
commit
365d8c987a
31
src/main.cpp
31
src/main.cpp
@ -5,6 +5,8 @@
|
||||
#include <Adafruit_NeoPixel.h>
|
||||
#include "ColorUtil.h"
|
||||
#include "controller.h"
|
||||
#include "SerialCmd.h"
|
||||
|
||||
/******************************************************************************
|
||||
* MACROS
|
||||
******************************************************************************/
|
||||
@ -78,6 +80,9 @@ void setup()
|
||||
{
|
||||
Serial.println(F("\nWifi mode is WIFI_OFF"));
|
||||
}
|
||||
|
||||
SerialCmd_clearCmdArray();
|
||||
|
||||
#ifdef FAN_ENABLED
|
||||
/* Setup FAN Control */
|
||||
pinMode(FAN_PIN, OUTPUT);
|
||||
@ -170,9 +175,31 @@ void loop()
|
||||
i = 0;
|
||||
}
|
||||
|
||||
pixels->fill(Color(255, 0,0));
|
||||
pixels->setBrightness(actualFanSpeedRpm);
|
||||
int readCharacter = SerialCmd_readFromSerial();
|
||||
|
||||
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();
|
||||
|
||||
#else
|
||||
RainbowCycle(pixels, &mRainbowIndex);
|
||||
Serial.print(mRainbowIndex);
|
||||
|
Loading…
Reference in New Issue
Block a user