Browse Source

Merge branch 'dev' of bitbucket.org:xoseperez/espurna into dev

fastled
Xose Pérez 7 years ago
parent
commit
e6d84f511d
3 changed files with 11 additions and 4 deletions
  1. +6
    -0
      code/build.sh
  2. +4
    -3
      code/espurna/relay.ino
  3. +1
    -1
      code/espurna/web.ino

+ 6
- 0
code/build.sh View File

@ -28,6 +28,12 @@ echo "Building for version $version"
# Create output folder # Create output folder
mkdir -p firmware mkdir -p firmware
if [ ! -e node_modules/gulp/bin/gulp.js ]; then
echo "--------------------------------------------------------------"
echo "Installing dependencies..."
npm install --only=dev
fi
# Recreate web interface # Recreate web interface
echo "--------------------------------------------------------------" echo "--------------------------------------------------------------"
echo "Building web interface..." echo "Building web interface..."


+ 4
- 3
code/espurna/relay.ino View File

@ -335,13 +335,14 @@ unsigned char relayParsePayload(const char * payload) {
value = 1; value = 1;
} else if (strcmp(p, "toggle") == 0) { } else if (strcmp(p, "toggle") == 0) {
value = 2; value = 2;
} else if (strcmp(p, "query") == 0) {
value = 3;
} else { } else {
value = p[0] - '0'; value = p[0] - '0';
} }
if (0 <= value && value <=2) return value;
return 0x99;
if (0 <= value && value <=3) return value;
return 0xFF;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// REST API // REST API


+ 1
- 1
code/espurna/web.ino View File

@ -143,7 +143,7 @@ void _wsParse(uint32_t client_id, uint8_t * payload, size_t length) {
if (data.containsKey("status")) { if (data.containsKey("status")) {
unsigned char value = relayParsePayload(data["status"]); unsigned char value = relayParsePayload(data["status"]);
if (value == 0xFF) {
if (value == 3) {
relayWS(); relayWS();


Loading…
Cancel
Save