4#include "../../defines.h"
5#if defined(ESP_M5) && !defined(ESP_M5_MINIMAL_SENSORS)
16#include <M5StickCPlus.h>
25 printf(
"KeyUnitSensorClass init %s\n", config);
33 printf(
"KeyUnitSensorClass destroy\n");
56#ifdef ATOM_QRCODE_MODULE
79void KeyUnitSensorClass::startTaskImpl(
void* _this)
81 SerialDebug.printf(
" startTaskImpl == %p\n", _this);
89#ifdef ATOM_QRCODE_MODULE
107void KeyUnitSensorClass::setupKeyUnit()
109 SerialDebug.printf(
"KeyUnitSensorClass.setupKeyUnit == %p\n",
this);
122 FastLED.addLeds<SK6812, 26, GRB>(this->_leds, 1);
129 FastLED.addLeds<SK6812, 23, GRB>(this->_leds, 1);
141 &this->startTaskImpl,
"led", 2024,
this, 0,
148void KeyUnitSensorClass::loopKeyUnit()
153 SerialDebug.println(
"KeyUnitSensorClass.Key Pressed");
157 long startTime = micros();
163 long endTime = micros();
164 double diffTime = endTime - startTime;
166 double seconds = diffTime / 1000000;
167 SerialDebug.printf(
"KU.Key Released: %f\n", seconds);
171 SerialDebug.printf(
"KU.Long Press: %f\n", seconds);
201void KeyUnitSensorClass::keyUnitLED() {
203 SerialDebug.printf(
" setupKeyUnit %p\n",
this);
205 _leds[0] = CRGB::Red;
207 for (
int i = 0; i < 255; i++)
210 FastLED.setBrightness(i);
214 for (
int i = 255; i > 0; i--)
217 FastLED.setBrightness(i);
227 SerialDebug.println(
"changeLedColor");
229 if (_ledColor > 2) _ledColor = 0;
233 _leds[0] = CRGB::Red;
236 _leds[0] = CRGB::Green;
239 _leds[0] = CRGB::Blue;
259 printf(
"KeyUnitSensorClass::setup()\n");
void sendCommandBLEClient_13orLess(String cmdString)
send a string of 13 characters or less
void processClientCommandChar_mainModule(char cmd)
single character version of processClientCommand (since many used that already)
void registerPinUse_mainModule(long pin, String pinName, String moduleName, boolean isI2C)
boolean getPreferenceBoolean_mainModule(int preferenceID)
called to set a preference (which will be an identifier and a string, which can be converted to a num...
void togglePreferenceBoolean_mainModule(int preferenceID)
toggles a preference boolean
#define PREFERENCE_STEPPER_FACTORY_CLOCKWISE_MOTOR_DIRECTION_SETTING
#define PREFERENCE_STEPPER_BUZZER_VALUE
stepper preferences
KeyUnitSensorClass(char *config)
constructor
void setup()
Pure Virtual Function.
~KeyUnitSensorClass()
destructor
void loop()
Pure Virtual Function.
virtual void messageCmd_SensorClassType(char *cmdValue)
void callCallback(char *info, boolean flag)
call the callback
virtual void messageSend_SensorClassType(char *sendValue)
virtual void messageSetVal_SensorClassType(char *setName, char *valValue, boolean deviceNameSpecified)
virtual void messageLocal_SensorClassType(char *message)
5.15.25 try a special command local to this class