final tuning of amulett
Signed-off-by: dragonchaser <christian@boltares.de>
This commit is contained in:
@@ -31,9 +31,9 @@ void Vibrate();
|
||||
|
||||
// LED configuration
|
||||
#define LED_TYPE WS2812B
|
||||
#define LED_DATA_PIN 1 // use 1 for GPIO 1 and 21 for builtin
|
||||
#define LED_DATA_PIN 21 // use 1 for GPIO 1 and 21 for builtin
|
||||
#define LED_NUM_LEDS 7 // use 1 for builtin and whatever your count is for extern
|
||||
#define LED_COLOR_ORDER RGB // USE GRB for the onboard led and RGB for the chain
|
||||
#define LED_COLOR_ORDER GRB // USE GRB for the onboard led and RGB for the chain
|
||||
|
||||
#define LED_BRIGHTNESS 96
|
||||
#define LED_BRIGHTNESS_DIMM 16
|
||||
@@ -44,9 +44,8 @@ void Vibrate();
|
||||
|
||||
// VIBRATION MOTOR configuration
|
||||
#define VIBRO_PIN 2
|
||||
#define VIBRO_REPEAT 3
|
||||
#define VIBRO_SMALL_DELAY 100
|
||||
#define VIBRO_BIG_DELAY 500
|
||||
#define VIBRO_REPEAT 10
|
||||
#define VIBRO_DELAY 250
|
||||
|
||||
// DATA maintenance configuration
|
||||
#define UPDATE_INTERVAL 10000 // how often do we update de database?
|
||||
@@ -61,7 +60,7 @@ void Vibrate();
|
||||
#define MIN_RSSI_POWER -50
|
||||
|
||||
// Use Serial interface for debugging true|false
|
||||
#define USE_SERIAL false
|
||||
#define USE_SERIAL true
|
||||
|
||||
// CONSTS
|
||||
static const PROGMEM std::map<String, String> overrideColors = {
|
||||
@@ -77,7 +76,7 @@ static const PROGMEM std::map<String, void*> blackList = {
|
||||
#define DEVICE_TYPE_PRIVATE_LAMP 3
|
||||
#define DEVICE_TYPE_AMULETT 4
|
||||
|
||||
#define DEVICE_TYPE DEVICE_TYPE_PUBLIC_LAMP
|
||||
#define DEVICE_TYPE DEVICE_TYPE_AMULETT
|
||||
|
||||
#ifndef DEVICE_TYPE
|
||||
// WE DO NOT HAVE A DEVICETYPE, so we do not have any variables here
|
||||
@@ -145,6 +144,8 @@ volatile uint8_t stepSegments;
|
||||
|
||||
TimerEvent updateTimer;
|
||||
|
||||
uint8_t vibrationCount = 0;
|
||||
|
||||
class AdvertisedDeviceCallbacks : public BLEAdvertisedDeviceCallbacks {
|
||||
void onResult(BLEAdvertisedDevice advertisedDevice) {
|
||||
if (advertisedDevice.getRSSI() > MIN_RSSI_POWER) {
|
||||
@@ -184,8 +185,8 @@ class AdvertisedDeviceCallbacks : public BLEAdvertisedDeviceCallbacks {
|
||||
// when the device is not in the database yet, vibrate on first connect
|
||||
if (useVibro) {
|
||||
auto it = deviceDatabase.find(color);
|
||||
if (it != deviceDatabase.end()) {
|
||||
Vibrate();
|
||||
if (it == deviceDatabase.end()) {
|
||||
vibrationCount = VIBRO_REPEAT;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -267,6 +268,10 @@ void loop() {
|
||||
}
|
||||
FillLEDsFromPaletteColors((startindex++) % LED_PALETTE_SIZE);
|
||||
FastLED.show();
|
||||
if (useVibro && vibrationCount > 0) {
|
||||
Vibrate();
|
||||
vibrationCount--;
|
||||
}
|
||||
FastLED.delay(1000/LED_FRAMES_PER_SECOND);
|
||||
}
|
||||
|
||||
@@ -327,13 +332,9 @@ void UpdatePalette() {
|
||||
|
||||
// Causes the vibration motor to vibrate
|
||||
void Vibrate() {
|
||||
for (int i = 0; i < VIBRO_REPEAT; i++) {
|
||||
for (int j = 0; j < 3; j++) {
|
||||
delay(VIBRO_SMALL_DELAY);
|
||||
digitalWrite(VIBRO_PIN, HIGH);
|
||||
delay(VIBRO_SMALL_DELAY);
|
||||
delay(VIBRO_DELAY);
|
||||
digitalWrite(VIBRO_PIN, LOW);
|
||||
}
|
||||
delay(VIBRO_BIG_DELAY);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user