Skip to content

Commit

Permalink
👕 Make all files LF instead of CRLF/mixed
Browse files Browse the repository at this point in the history
  • Loading branch information
marvinroger committed Dec 5, 2016
1 parent cdfb1e7 commit 26dafb8
Show file tree
Hide file tree
Showing 14 changed files with 297 additions and 297 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1 @@
/config.json
/config.json
48 changes: 24 additions & 24 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
language: python
python:
- "2.7"

env:
- PLATFORMIO_CI_SRC=examples/CustomSettings
- PLATFORMIO_CI_SRC=examples/DoorSensor
- PLATFORMIO_CI_SRC=examples/HookToEvents
- PLATFORMIO_CI_SRC=examples/IteadSonoff
- PLATFORMIO_CI_SRC=examples/LightOnOff
- PLATFORMIO_CI_SRC=examples/TemperatureSensor
- PLATFORMIO_CI_SRC=examples/LedStrip
- PLATFORMIO_CI_SRC=examples/Broadcast
- PLATFORMIO_CI_SRC=examples/GlobalInputHandler
- CPPLINT=true

install:
- pip install -U platformio
- pip install cpplint
# install current build as a library with all dependencies
- platformio lib -g install file://.

script:
- if [[ "$CPPLINT" ]]; then make cpplint; else platformio ci --board=esp01 --board=nodemcuv2; fi
language: python
python:
- "2.7"

env:
- PLATFORMIO_CI_SRC=examples/CustomSettings
- PLATFORMIO_CI_SRC=examples/DoorSensor
- PLATFORMIO_CI_SRC=examples/HookToEvents
- PLATFORMIO_CI_SRC=examples/IteadSonoff
- PLATFORMIO_CI_SRC=examples/LightOnOff
- PLATFORMIO_CI_SRC=examples/TemperatureSensor
- PLATFORMIO_CI_SRC=examples/LedStrip
- PLATFORMIO_CI_SRC=examples/Broadcast
- PLATFORMIO_CI_SRC=examples/GlobalInputHandler
- CPPLINT=true

install:
- pip install -U platformio
- pip install cpplint
# install current build as a library with all dependencies
- platformio lib -g install file://.

script:
- if [[ "$CPPLINT" ]]; then make cpplint; else platformio ci --board=esp01 --board=nodemcuv2; fi
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
cpplint:
cpplint --repository=. --recursive --filter=-whitespace/line_length,-legal/copyright,-runtime/printf,-build/include,-build/namespace,-runtime/int ./src
.PHONY: cpplint
cpplint:
cpplint --repository=. --recursive --filter=-whitespace/line_length,-legal/copyright,-runtime/printf,-build/include,-build/namespace,-runtime/int ./src
.PHONY: cpplint
28 changes: 14 additions & 14 deletions data/homie/example.config.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{
"name": "Kitchen light",
"wifi": {
"ssid": "Network_1",
"password": "I'm a Wi-Fi password!"
},
"mqtt": {
"host": "192.168.1.20",
"port": 1883
},
"ota": {
"enabled": false
}
}
{
"name": "Kitchen light",
"wifi": {
"ssid": "Network_1",
"password": "I'm a Wi-Fi password!"
},
"mqtt": {
"host": "192.168.1.20",
"port": 1883
},
"ota": {
"enabled": false
}
}
36 changes: 18 additions & 18 deletions examples/Broadcast/Broadcast.ino
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
#include <Homie.h>

bool broadcastHandler(const String& level, const String& value) {
#include <Homie.h>

bool broadcastHandler(const String& level, const String& value) {
Homie.getLogger() << "Received broadcast level " << level << ": " << value << endl;
return true;
}

void setup() {
Serial.begin(115200);
Serial << endl << endl;
Homie_setFirmware("broadcast-test", "1.0.0");
Homie.setBroadcastHandler(broadcastHandler);

Homie.setup();
}

void loop() {
Homie.loop();
}
return true;
}

void setup() {
Serial.begin(115200);
Serial << endl << endl;
Homie_setFirmware("broadcast-test", "1.0.0");
Homie.setBroadcastHandler(broadcastHandler);

Homie.setup();
}

void loop() {
Homie.loop();
}
74 changes: 37 additions & 37 deletions examples/CustomSettings/CustomSettings.ino
Original file line number Diff line number Diff line change
@@ -1,42 +1,42 @@
#include <Homie.h>

const int DEFAULT_TEMPERATURE_INTERVAL = 300;

unsigned long lastTemperatureSent = 0;

HomieNode temperatureNode("temperature", "temperature");

#include <Homie.h>

const int DEFAULT_TEMPERATURE_INTERVAL = 300;

unsigned long lastTemperatureSent = 0;

HomieNode temperatureNode("temperature", "temperature");

HomieSetting<long> temperatureIntervalSetting("temperatureInterval", "The temperature interval in seconds");

void setupHandler() {
temperatureNode.setProperty("unit").send("c");
}

void loopHandler() {
if (millis() - lastTemperatureSent >= temperatureIntervalSetting.get() * 1000UL || lastTemperatureSent == 0) {
float temperature = 22; // Fake temperature here, for the example

void setupHandler() {
temperatureNode.setProperty("unit").send("c");
}

void loopHandler() {
if (millis() - lastTemperatureSent >= temperatureIntervalSetting.get() * 1000UL || lastTemperatureSent == 0) {
float temperature = 22; // Fake temperature here, for the example
Homie.getLogger() << "Temperature: " << temperature << " °C" << endl;
temperatureNode.setProperty("degrees").send(String(temperature));
lastTemperatureSent = millis();
}
}

void setup() {
Serial.begin(115200);
Serial << endl << endl;
Homie_setFirmware("temperature-setting", "1.0.0");
Homie.setSetupFunction(setupHandler).setLoopFunction(loopHandler);

temperatureNode.advertise("unit");
temperatureNode.advertise("degrees");

temperatureNode.setProperty("degrees").send(String(temperature));
lastTemperatureSent = millis();
}
}

void setup() {
Serial.begin(115200);
Serial << endl << endl;
Homie_setFirmware("temperature-setting", "1.0.0");
Homie.setSetupFunction(setupHandler).setLoopFunction(loopHandler);

temperatureNode.advertise("unit");
temperatureNode.advertise("degrees");

temperatureIntervalSetting.setDefaultValue(DEFAULT_TEMPERATURE_INTERVAL).setValidator([] (long candidate) {
return candidate > 0;
});

Homie.setup();
}

void loop() {
Homie.loop();
}

Homie.setup();
}

void loop() {
Homie.loop();
}
44 changes: 22 additions & 22 deletions examples/GlobalInputHandler/GlobalInputHandler.ino
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
#include <Homie.h>

HomieNode lightNode("light", "switch");

bool globalInputHandler(const HomieNode& node, const String& property, const HomieRange& range, const String& value) {
#include <Homie.h>

HomieNode lightNode("light", "switch");

bool globalInputHandler(const HomieNode& node, const String& property, const HomieRange& range, const String& value) {
Homie.getLogger() << "Received on node " << node.getId() << ": " << property << " = " << value << endl;
return true;
}

void setup() {
Serial.begin(115200);
Serial << endl << endl;
Homie_setFirmware("global-input-handler", "1.0.0");
Homie.setGlobalInputHandler(globalInputHandler);

lightNode.advertise("on").settable();

Homie.setup();
}

void loop() {
Homie.loop();
}
return true;
}

void setup() {
Serial.begin(115200);
Serial << endl << endl;
Homie_setFirmware("global-input-handler", "1.0.0");
Homie.setGlobalInputHandler(globalInputHandler);

lightNode.advertise("on").settable();

Homie.setup();
}

void loop() {
Homie.loop();
}
82 changes: 41 additions & 41 deletions examples/LedStrip/LedStrip.ino
Original file line number Diff line number Diff line change
@@ -1,42 +1,42 @@
#include <Homie.h>

const unsigned char NUMBER_OF_LED = 4;
const unsigned char LED_PINS[NUMBER_OF_LED] = { 16, 5, 4, 0 };

HomieNode stripNode("strip", "strip");

bool stripLedHandler(const HomieRange& range, const String& value) {
if (!range.isRange) return false; // if it's not a range

if (range.index < 1 || range.index > NUMBER_OF_LED) return false; // if it's not a valid range

if (value != "on" && value != "off") return false; // if the value is not valid

bool on = (value == "on");

digitalWrite(LED_PINS[range.index - 1], on ? HIGH : LOW);
stripNode.setProperty("led").setRange(range).send(value); // Update the state of the led
#include <Homie.h>

const unsigned char NUMBER_OF_LED = 4;
const unsigned char LED_PINS[NUMBER_OF_LED] = { 16, 5, 4, 0 };

HomieNode stripNode("strip", "strip");

bool stripLedHandler(const HomieRange& range, const String& value) {
if (!range.isRange) return false; // if it's not a range

if (range.index < 1 || range.index > NUMBER_OF_LED) return false; // if it's not a valid range

if (value != "on" && value != "off") return false; // if the value is not valid

bool on = (value == "on");

digitalWrite(LED_PINS[range.index - 1], on ? HIGH : LOW);
stripNode.setProperty("led").setRange(range).send(value); // Update the state of the led
Homie.getLogger() << "Led " << range.index << " is " << value << endl;

return true;
}

void setup() {
for (int i = 0; i < NUMBER_OF_LED; i++) {
pinMode(LED_PINS[i], OUTPUT);
digitalWrite(LED_PINS[i], LOW);
}

Serial.begin(115200);
Serial << endl << endl;

Homie_setFirmware("awesome-ledstrip", "1.0.0");

stripNode.advertiseRange("led", 1, NUMBER_OF_LED).settable(stripLedHandler);

Homie.setup();
}

void loop() {
Homie.loop();
}

return true;
}

void setup() {
for (int i = 0; i < NUMBER_OF_LED; i++) {
pinMode(LED_PINS[i], OUTPUT);
digitalWrite(LED_PINS[i], LOW);
}

Serial.begin(115200);
Serial << endl << endl;

Homie_setFirmware("awesome-ledstrip", "1.0.0");

stripNode.advertiseRange("led", 1, NUMBER_OF_LED).settable(stripLedHandler);

Homie.setup();
}

void loop() {
Homie.loop();
}
Loading

0 comments on commit 26dafb8

Please sign in to comment.