Browse Source

tweak magic numbers

main
Hendrik Langer 7 years ago
parent
commit
8a90dae6e4
  1. 2
      software/src/MyMQTT.cpp
  2. 18
      software/src/led.cpp
  3. 6
      software/src/shelf.cpp
  4. 2
      software/src/wifi.cpp

2
software/src/MyMQTT.cpp

@ -100,7 +100,7 @@ void MyMQTT::onMqttDisconnect(AsyncMqttClientDisconnectReason reason) {
"mqttReconnectTask", /* String with name of task. */
1024, /* Stack size in words. */
this, /* Parameter passed as input of the task */
1, /* Priority of the task. */
tskIDLE_PRIORITY, /* Priority of the task. */
&mqttTaskHandle); /* Task handle. */
}

18
software/src/led.cpp

@ -10,12 +10,10 @@ using namespace std;
Led::Led(void) {
index = 0;
duration = 0;
change = true;
color = CRGB::Orange;
}
void Led::loop_rainbow(void) {
fill_rainbow(leds, NUM_LEDS, index, 7);
fill_rainbow(leds, NUM_LEDS, index, 14);
}
void Led::loop_confetti(void)
@ -39,6 +37,10 @@ void Led::loop_dispense(void) {
fadeToBlackBy( leds, NUM_LEDS, 20);
int pos = beatsin16( 13, 0, NUM_LEDS-1 );
leds[pos] += CHSV( index, 255, 192);
leds[0] = CRGB::White;
leds[NUM_LEDS-1] = CRGB::White;
leds[NUM_LEDS-2] = CRGB::White;
}
void Led::loop_steady(void) {
@ -68,17 +70,19 @@ void Led::setup(void) {
pinMode(LED_PIN, OUTPUT);
FastLED.addLeds<LED_TYPE, LED_PIN, COLOR_ORDER>(leds, NUM_LEDS);
FastLED.setBrightness(96);
FastLED.setCorrection(0xFF6060);
FastLED.setCorrection(0xFF5050);
fill_solid(leds, NUM_LEDS, CRGB::White);
FastLED.show();
color = CRGB::Orange;
change = true;
refresh = &Led::loop_steady;
delay(100);
xTaskCreate(
&cTaskWrapper, /* Task function. */
"ledAnimationTask", /* String with name of task. */
4096, /* Stack size in words. */
2048, /* Stack size in words. */
this, /* Parameter passed as input of the task */
1, /* Priority of the task. */
tskIDLE_PRIORITY+3, /* Priority of the task. */
&ledTaskHandle); /* Task handle. */
}

6
software/src/shelf.cpp

@ -30,9 +30,9 @@ void Shelf::dispenseTask(void* parameters) {
item.at(num)->quantity--;
led.changeAnimation(1, 0);
pusher.push(num);
delay(500);
vTaskDelay(500 / portTICK_PERIOD_MS);
led.changeAnimation(2, 0);
delay(7000);
vTaskDelay(7000 / portTICK_PERIOD_MS);
led.changeAnimation(0, 0);
vTaskDelete(NULL);
@ -44,5 +44,5 @@ void Shelf::cTaskWrapper(void* parameters) {
void Shelf::dispense(int num) {
this->num = num;
xTaskCreate(&cTaskWrapper, "dispenseTask", 1024, this, 0, &dispenseTaskHandle);
xTaskCreate(&cTaskWrapper, "dispenseTask", 1024, this, tskIDLE_PRIORITY+2, &dispenseTaskHandle);
}

2
software/src/wifi.cpp

@ -46,7 +46,7 @@ xTaskCreate(
"wifiReconnectTask", /* String with name of task. */
1024, /* Stack size in words. */
this, /* Parameter passed as input of the task */
1, /* Priority of the task. */
tskIDLE_PRIORITY+1, /* Priority of the task. */
&wifiTaskHandle); /* Task handle. */
}

Loading…
Cancel
Save