1
0
This commit is contained in:
2019-03-15 23:32:30 -04:00
parent f6f67e382e
commit 3befb03dd4

View File

@@ -12,9 +12,10 @@
#include "BluefruitConfig.h" #include "BluefruitConfig.h"
#define REQUIRE_SERIAL true
#define BT_SCAN_MS 200 #define BT_SCAN_MS 200
#define MINIMUM_FIRMWARE_VERSION "0.7.0" #define MIN_FIRMWARE "0.7.0"
#define FACTORYRESET_ENABLE 1 #define FACTORYRESET true
#define DIM_FACTOR 50 #define DIM_FACTOR 50
Adafruit_BluefruitLE_SPI ble(BLUEFRUIT_SPI_CS, BLUEFRUIT_SPI_IRQ, BLUEFRUIT_SPI_RST); Adafruit_BluefruitLE_SPI ble(BLUEFRUIT_SPI_CS, BLUEFRUIT_SPI_IRQ, BLUEFRUIT_SPI_RST);
@@ -24,15 +25,15 @@ void bluetooth_setup(){
Serial.println(F("Couldn't find Bluefruit, make sure it's in CoMmanD mode & check wiring?")); Serial.println(F("Couldn't find Bluefruit, make sure it's in CoMmanD mode & check wiring?"));
while(1); // halt while(1); // halt
} }
if ( FACTORYRESET_ENABLE ) { if ( FACTORYRESET ) {
if ( ! ble.factoryReset() ){ if ( ! ble.factoryReset() ){
Serial.println(F("Couldn't factory reset")); Serial.println(F("Couldn't factory reset"));
while(1); // halt while(1); // halt
} }
} }
if ( !ble.isVersionAtLeast(MINIMUM_FIRMWARE_VERSION) ){ if ( !ble.isVersionAtLeast(MIN_FIRMWARE) ){
Serial.print(F("Callback requires at least")); Serial.print(F("Callback requires at least"));
Serial.println(F(MINIMUM_FIRMWARE_VERSION)); Serial.println(F(MIN_FIRMWARE));
while(1); // halt while(1); // halt
} }
pinMode(BLUEFRUIT_SPI_IRQ, INPUT_PULLUP); pinMode(BLUEFRUIT_SPI_IRQ, INPUT_PULLUP);
@@ -162,9 +163,11 @@ class Strip {
Strip strip = Strip(6, 144, 100); Strip strip = Strip(6, 144, 100);
void setup(void) { void setup(void) {
//strip.off() strip.off();
while (!Serial); // required for Flora & Micro if (REQUIRE_SERIAL){
while (!Serial);
Serial.begin(115200); Serial.begin(115200);
}
bluetooth_setup(); bluetooth_setup();
Serial.println(F("Ready")); Serial.println(F("Ready"));
} }