Lighmodes working
This commit is contained in:
@ -53,7 +53,7 @@ uint8_t sendSpeedDecimals = 0;
|
||||
long lastPacket = 0;
|
||||
|
||||
bool isConnected = false;
|
||||
|
||||
uint8_t oldOptions = 0;
|
||||
#define FANS_AUTO 0
|
||||
#define FANS_ON 1
|
||||
#define FANS_OFF 2
|
||||
@ -63,13 +63,14 @@ int fanMode = FANS_AUTO;
|
||||
|
||||
#include "lights.h"
|
||||
void setBoardOptions(uint8_t options) {
|
||||
if(lightActive != (options >> 4) & 1) {
|
||||
lightActive = (options >> 4) & 1;
|
||||
if(options != oldOptions) {
|
||||
oldOptions = options;
|
||||
shouldUpdateLights = true;
|
||||
Serial.println("true2");
|
||||
}
|
||||
|
||||
lightMode = options & 3;
|
||||
|
||||
lightActive = (options >> 3) & 1;
|
||||
fanMode = (options >> 2) & 3;
|
||||
}
|
||||
|
||||
@ -130,7 +131,8 @@ void OnDataRecv(const uint8_t *mac_addr, const uint8_t *data, int data_len) {
|
||||
// Could check mac here for some security
|
||||
writeServos(recData[0], recData[1]);
|
||||
setBoardOptions(recData[2]);
|
||||
|
||||
Serial.print("recieved: ");
|
||||
Serial.println(recData[2], BIN);
|
||||
display.clear();
|
||||
char buf[25];
|
||||
sprintf(buf, "1: %i | 2: %i", recData[0], recData[1]);
|
||||
@ -311,7 +313,6 @@ void setup() {
|
||||
Serial.println("ESPNow Init Failed");
|
||||
ESP.restart();
|
||||
}
|
||||
esp_now_set_self_role(ESP_NOW_ROLE_COMBO);
|
||||
|
||||
// Once ESPNow is successfully Init, we will register for recv CB to
|
||||
// get recv packer info.
|
||||
|
Reference in New Issue
Block a user