Skip to content

Commit

Permalink
Move credentials to an untracked file
Browse files Browse the repository at this point in the history
  • Loading branch information
forkineye committed Oct 30, 2019
1 parent fe1531b commit 2a86765
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 12 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ node_modules
package-lock.json
*.ino.generic.bin
.doxygen/doc
secrets.h
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ before_script:
- npm install -g gulp-cli
- npm install
script:
- echo '#define SECRETS_SSID "SSID_NOT_SET"' > $ESPS_HOME/secrets.h
- echo '#define SECRETS_PASS "PASSPHRASE_NOT_SET"' >> $ESPS_HOME/secrets.h
- arduino --verify $ESPS_HOME/ESPixelStick.ino
- mv $BUILD/ESPixelStick.ino.bin $DIST/firmware/espixelstick-travis.bin
- gulp
Expand Down
20 changes: 11 additions & 9 deletions ESPixelStick.ino
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,13 @@
/*****************************************/
/* BEGIN - Configuration */
/*****************************************/
// Create secrets.h with a #define for SECRETS_SSID and SECRETS_PASS
// or delete the #include and enter them directly below.
#include "secrets.h"

/* Fallback configuration if config.json is empty or fails */
const char ssid[] = "portabox";
const char passphrase[] = "portaboxhaha";
const char ssid[] = SECRETS_SSID;
const char passphrase[] = SECRETS_PASS;

/*****************************************/
/* END - Configuration */
Expand Down Expand Up @@ -245,6 +248,9 @@ void setup() {

wifiDisconnectHandler = WiFi.onStationModeDisconnected(onWiFiDisconnect);

// Handle OTA update from asynchronous callbacks
Update.runAsync(true);

// Configure and start the web server
initWeb();
}
Expand Down Expand Up @@ -339,11 +345,8 @@ void onWiFiDisconnect(const WiFiEventStationModeDisconnected &event) {

// Configure and start the web server
void initWeb() {
// Handle OTA update from asynchronous callbacks
Update.runAsync(true);

// Add header for SVG plot support?
DefaultHeaders::Instance().addHeader("Access-Control-Allow-Origin", "*");
DefaultHeaders::Instance().addHeader(F("Access-Control-Allow-Origin"), "*");

// Setup WebSockets
ws.onEvent(wsEvent);
Expand Down Expand Up @@ -376,13 +379,12 @@ void initWeb() {
request->send(404, "text/plain", "Page not found");
});

DefaultHeaders::Instance().addHeader(F("Access-Control-Allow-Origin"), "*");

/*
// Config file upload handler - only in station mode
web.on("/config", HTTP_POST, [](AsyncWebServerRequest *request) {
ws.textAll("X6");
}, handle_config_upload).setFilter(ON_STA_FILTER);

*/
web.begin();

LOG_PORT.print(F("- Web Server started on port "));
Expand Down
2 changes: 1 addition & 1 deletion src/ESPixelStick.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ const char BUILD_DATE[] = __DATE__;
// Configuration file params
#define CONFIG_MAX_SIZE 4096 ///< Sanity limit for config file

/// Configuration structure
/// Core configuration structure
typedef struct {
// Device
String id; ///< Device ID
Expand Down
7 changes: 5 additions & 2 deletions src/output/WS2811.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,11 @@ uint16_t WS2811::getTupleCount() {
}

void WS2811::validate() {
//TODO: check pixelCount
if (pixelCount > PIXEL_LIMIT)
pixelCount = PIXEL_LIMIT;
else if (pixelCount < 1)
pixelCount = 1;

if (groupSize > pixelCount)
groupSize = pixelCount;
else if (groupSize < 1)
Expand Down Expand Up @@ -308,5 +312,4 @@ void WS2811::render() {

uint8_t* WS2811::getData() {
return asyncdata; // data post grouping or zigzaging
// return pixdata;
}

0 comments on commit 2a86765

Please sign in to comment.