Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix compliation issues #121

Merged
merged 11 commits into from
Dec 23, 2019
15 changes: 10 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,17 @@ before_install:
install:
- mkdir -p $HOME/arduino_ide/libraries/
- cd $HOME/arduino_ide/libraries/
- git clone --branch 2.1.4 https://github.com/Makuna/NeoPixelBus.git
- git clone https://github.com/interactive-matter/aJson.git
- git clone https://github.com/PaulStoffregen/Time.git
- git clone https://github.com/gmag11/NtpClient.git
- git clone -o cf7b4a6 https://github.com/Makuna/NeoPixelBus
- git clone -o b05d455 https://github.com/PaulStoffregen/Time
- git clone -o 3c22f2f https://github.com/gmag11/NtpClient
- git clone -o b592ac6 https://github.com/me-no-dev/ESPAsyncUDP
- git clone -o ec56354 https://github.com/interactive-matter/aJson
- sed -i -e 's|#define PRINT_BUFFER_LEN 256|#define PRINT_BUFFER_LEN 4096|g' aJson/aJSON.h
- cd -
- cd aJson
- curl -OSLs https://gitlab.com/xarduino/lightsw/raw/2424e3a9348e7144373311af132ced38f14489ba/patch/ajson-void-flush.patch
- git apply ajson-void-flush.patch
- rm ajson-void-flush.patch
- cd $TRAVIS_BUILD_DIR
script:
- sed -i -e 's|#include "/secrets.h"|//#include "/secrets.h"|g' ESP8266HueEmulator/ESP8266HueEmulator.ino
- sed -i -e 's|//const char|const char|g' ESP8266HueEmulator/ESP8266HueEmulator.ino
Expand Down
3 changes: 1 addition & 2 deletions ESP8266HueEmulator/ESP8266HueEmulator.ino
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
#include "LightService.h"

// these are only used in LightHandler.cpp, but it seems that the IDE only scans the .ino and real libraries for dependencies
#include <ESP8266WebServer.h>
#include "SSDP.h"
#include <aJSON.h> // Replace avm/pgmspace.h with pgmspace.h there and set #define PRINT_BUFFER_LEN 4096 ################# IMPORTANT

Expand All @@ -32,7 +31,7 @@ RgbColor black = RgbColor(0);

#define pixelCount 30
#define pixelPin 2 // Strip is attached to GPIO2 on ESP-01
NeoPixelBus<NeoGrbFeature, NeoEsp8266Uart800KbpsMethod> strip(MAX_LIGHT_HANDLERS * NUM_PIXELS_PER_LIGHT, pixelPin);
NeoPixelBus<NeoGrbFeature, NeoEsp8266Uart1Ws2812xMethod> strip(MAX_LIGHT_HANDLERS * NUM_PIXELS_PER_LIGHT, pixelPin);
NeoPixelAnimator animator(MAX_LIGHT_HANDLERS * NUM_PIXELS_PER_LIGHT, NEO_MILLISECONDS); // NeoPixel animation management object
LightServiceClass LightService;

Expand Down
2 changes: 1 addition & 1 deletion ESP8266HueEmulator/LightService.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ class WcFnRequestHandler : public RequestHandler {
{
assert(_wildcard != '/');
// verify that the URI is reasonable (only contains wildcard at the beginning/end/whole path segments
for(int i = 0; i < _uri.length(); i++) {
for(size_t i = 0; i < _uri.length(); i++) {
if (_uri[i] == _wildcard) {
if (i != 0 && i != _uri.length() - 1 && (_uri[i-1] != '/' || _uri[i+1] != '/')) {
assert(false);
Expand Down
2 changes: 1 addition & 1 deletion ESP8266HueEmulator/LightService.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include <Arduino.h>
#include <ESP8266WebServer.h>

enum HueColorType {
TYPE_HUE_SAT, TYPE_CT, TYPE_XY
Expand Down Expand Up @@ -49,7 +50,6 @@ class LightHandler {
#define MAX_LIGHT_HANDLERS 2
#define COLOR_SATURATION 255.0f

class ESP8266WebServer;
class LightServiceClass {
const char* _friendlyName;

Expand Down
11 changes: 5 additions & 6 deletions ESP8266HueEmulator/SSDP.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,6 @@ SSDPClass::~SSDPClass(){
bool SSDPClass::begin(){
_pending = false;

uint32_t chipId = ESP.getChipId();
String mac = WiFi.macAddress();
mac.replace(":", "");
mac.toLowerCase();
Expand All @@ -181,14 +180,14 @@ bool SSDPClass::begin(){
return false;
}

if (!_server->listen(*IP_ADDR_ANY, SSDP_PORT)) {
if (!_server->listen(IP_ADDR_ANY, SSDP_PORT)) {
return false;
}

_server->setMulticastInterface(ifaddr);
_server->setMulticastTTL(_ttl);
_server->onRx(std::bind(&SSDPClass::_update, this));
if (!_server->connect(multicast_addr, SSDP_PORT)) {
if (!_server->connect(&multicast_addr, SSDP_PORT)) {
return false;
}

Expand All @@ -199,11 +198,11 @@ bool SSDPClass::begin(){

void SSDPClass::_send(ssdp_method_t method){
char buffer[1460];
uint32_t ip = WiFi.localIP();
ip_addr_t ip = WiFi.localIP();

int len;
if (_messageFormatCallback) {
len = _messageFormatCallback(this, buffer, sizeof(buffer), method != NONE, SSDP_INTERVAL, _modelName, _modelNumber, _uuid, _deviceType, ip, _port, _schemaURL);
len = _messageFormatCallback(this, buffer, sizeof(buffer), method != NONE, SSDP_INTERVAL, _modelName, _modelNumber, _uuid, _deviceType, ip.addr, _port, _schemaURL);
} else {
len = snprintf(buffer, sizeof(buffer),
_ssdp_packet_template,
Expand Down Expand Up @@ -244,7 +243,7 @@ void SSDPClass::_send(ssdp_method_t method){
}

void SSDPClass::schema(WiFiClient client){
uint32_t ip = WiFi.localIP();
ip_addr_t ip = WiFi.localIP();
client.printf(_ssdp_schema_template,
IP2STR(&ip), _port,
_deviceType,
Expand Down