1
0

speed command

This commit is contained in:
2019-03-16 00:30:55 -04:00
parent 3befb03dd4
commit 9e85793660

View File

@@ -16,7 +16,7 @@
#define BT_SCAN_MS 200
#define MIN_FIRMWARE "0.7.0"
#define FACTORYRESET true
#define DIM_FACTOR 50
#define DIM_FACTOR 80
Adafruit_BluefruitLE_SPI ble(BLUEFRUIT_SPI_CS, BLUEFRUIT_SPI_IRQ, BLUEFRUIT_SPI_RST);
@@ -56,8 +56,11 @@ void on_disconnect(void){
}
void BleUartRX(char data[], uint16_t len){
Serial.print( F("[BLE UART RX] " ) );
Serial.print( F("[RX] " ) );
Serial.write(data, len);
if (data[0] == 's' && len > 1){
setWait(data, len);
}
Serial.println();
}
@@ -72,16 +75,17 @@ class Strip {
private:
uint8_t pin;
uint8_t num_pixels;
uint16_t wait;
unsigned long last;
uint8_t offset;
Adafruit_NeoPixel pixel;
public:
Strip(uint8_t led_pin, uint8_t strip_len, uint16_t wait_ms) {
uint16_t wait;
Strip(uint8_t led_pin, uint8_t strip_len) {
pin = led_pin;
num_pixels = strip_len;
wait = wait_ms;
wait = 0;
last = millis();
offset = 0;
pixel = Adafruit_NeoPixel(num_pixels, pin, NEO_GRBW + NEO_KHZ800);
@@ -160,7 +164,18 @@ class Strip {
}
};
Strip strip = Strip(6, 144, 100);
volatile Strip strip = Strip(6, 144);
void setWait(char data[], uint16_t len){
String wait = "";
for (uint16_t index=1; index<len; index++){
wait += (char)data[index];
}
uint16_t wait_int = wait.toInt();
if (wait_int >= 0 && wait_int < 10000){
strip.wait = wait_int;
}
}
void setup(void) {
strip.off();