Skip to content

Commit 62b2b24

Browse files
committed
Added more Interface config
Added support for H801 device
1 parent 95b600b commit 62b2b24

13 files changed

+878
-164
lines changed

.travis.yml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,14 @@ install:
3030
# Download and install recent cmake
3131
- |
3232
if [[ ${TRAVIS_OS_NAME} == "linux" ]]; then
33-
CMAKE_URL="http://www.cmake.org/files/v3.5/cmake-3.5.1-Linux-x86_64.tar.gz"
34-
mkdir -p ${DEPS_DIR}/cmake
35-
travis_retry wget --no-check-certificate --quiet -O - ${CMAKE_URL} | tar --strip-components=1 -xz -C ${DEPS_DIR}/cmake
33+
DEPS_DIR="${TRAVIS_BUILD_DIR}/deps"
34+
mkdir -p ${DEPS_DIR} && cd ${DEPS_DIR}
35+
CMAKE_URL="http://www.cmake.org/files/v3.5/cmake-3.5.2-Linux-x86_64.tar.gz"
36+
mkdir cmake && travis_retry wget --no-check-certificate --quiet -O - ${CMAKE_URL} | tar --strip-components=1 -xz -C cmake
3637
export PATH=${DEPS_DIR}/cmake/bin:${PATH}
38+
else
39+
if ! brew ls --version cmake &>/dev/null; then brew install cmake; fi
3740
fi
38-
3941
script:
4042
- echo "Run desktop (native) tests on Travis.CI Linux machine"
4143
- platformio upgrade

README.md

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ The initial code came from https://github.com/mertenats/Arilux_AL-LC0X but in th
1212

1313
This firmware has been tested with OpenHAB and just a bit om Home Assistance.
1414

15-
## Features:
15+
## Features
1616

1717
- Fade from any color to any other color smoothly without apparent brightness changes without special commands
1818
- ON/OFF states will correctly fade in/out and remember the last color (in EEPROM)
@@ -30,28 +30,34 @@ This firmware has been tested with OpenHAB and just a bit om Home Assistance.
3030
- Native support for OpenHAB and should work with Home Assistant with MQTT
3131
- Fading using cie1931 math
3232
- Color correction using rainbow table for better color reproduction
33+
- Setup pins from web
3334

34-
### Current effects are:
35+
### Current effects
3536

3637
- Rainbow: Will keep fading over the rainbow of colors with a given time period
3738
- Transition: Change from color1 to color2 over a period of time
3839
- Flash: Flash between two colors or between black and the current color
3940
- Strobe: Strobe between two colors, period can be given
4041

41-
## Todo
42-
43-
- Setup led pins with web interface
44-
45-
Tested with the [ESP8266 Wi-Fi chip][esp8266] and Wemos devices.
46-
4742
### Configuration
4843

49-
Configuration is done using the web interface
44+
Configuration is done using the web interface including LedPWM pins
5045

5146
## Updating
5247

5348
OTA is enabled on this firmware. Assuming the device is plugged in you should find the device using
5449
```platformio device list --mdns --logical | grep arduino```
50+
look for a device with a name like `RGBW_XXXXXXXX`
51+
52+
```bash
53+
myMachine:Esp8266Leds rvt$ platformio device list --mdns --logical | grep arduino
54+
RGBW_00CCAA42._arduino._tcp.local.
55+
Type: _arduino._tcp.local.
56+
ARILUX00879231._arduino._tcp.local.
57+
Type: _arduino._tcp.local.
58+
ARILUX00AD44B1._arduino._tcp.local.
59+
Type: _arduino._tcp.local.
60+
```
5561

5662
## Control
5763

@@ -86,19 +92,14 @@ enum BootMode {
8692
};
8793
```
8894

89-
#### Bootorder:
95+
#### Bootorder
9096

9197
- Load default settings
9298
- Get HSB values from LittleFS
93-
- Subscribe state topic for two seconds, use any found settings over a period of two seconds
99+
- Subscribe state topic for two seconds
94100
- Subscribe to command topic and overwrite any settings found in state over a period of two seconds
95101

96-
Considarations:
97-
98-
- After bootsequence the device will always be on in the last configured color setting
99-
- If no wifi and/or mqtt server found we load up color from LittleFS
100-
- When filesystem is empty we load up a brightness of 50
101-
- When filesystem has stored brightness of 0 we load up a brightness of minimum 5
102+
- Based on Bootmode we decide what we do with initial status
102103

103104
#### Control Codes and examples
104105

@@ -386,4 +387,3 @@ You Must credit the author and link to this repository if you implement any of h
386387
[Home Assistant's MQTT discovery functionality]: https://home-assistant.io/docs/mqtt/discovery/
387388
[MQTT]: http://mqtt.org/
388389
[Alternative firmware]: https://github.com/mertenats/Arilux_AL-LC0X
389-

generateHtmlArray.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/bin/bash
2+
3+
cd web
4+
cat *.js | gzip -9 > jscript.js.gz
5+
xxd --include jscript.js.gz > ../src/jscript.generated.h
6+
rm jscript.js.gz
7+
8+
for f in *.html
9+
do
10+
cat $f > "${f}.nt"
11+
echo -ne "\0" >> "${f}.nt"
12+
xxd -i "${f}.nt" > ../src/"${f/\./_}".generated.h
13+
done
14+
rm -rf *.nt

lib/eeprom/crceeprom.h

Lines changed: 0 additions & 55 deletions
This file was deleted.

platformio.ini

Lines changed: 72 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,15 @@
77
;
88
; Please visit documentation for the other options and examples
99
; https://docs.platformio.org/page/projectconf.html
10+
1011
[platformio]
1112

1213
[common_env_data]
13-
lib_deps_embedded_external =
14-
15-
https://github.com/rvt/statemachine
16-
https://github.com/rvt/opt-parser
17-
ESP_EEPROM
18-
https://github.com/tzapu/WiFiManager#0fd0c332229ab82cce060d7318c42def65a549b5
14+
lib_deps_embedded_external =
15+
16+
https://github.com/rvt/statemachine
17+
https://github.com/rvt/opt-parser
18+
https://github.com/tzapu/WiFiManager#0fd0c332229ab82cce060d7318c42def65a549b5
1919

2020
[env:LC10_OLD]
2121
platform = espressif8266
@@ -24,63 +24,51 @@ board = esp01_1m
2424
upload_resetmethod = ck
2525
upload_protocol = espota
2626
board_build.flash_mode = dio
27-
build_flags =
28-
-Wl,-Teagle.flash.1m64.ld
29-
-DPIO_FRAMEWORK_ARDUINO_LWIP2_LOW_MEMORY
30-
-DRED_PIN=5
31-
-DGREEN_PIN=14
32-
-DBLUE_PIN=12
33-
-DWHITE1_PIN=13
34-
-DRF_PIN=3
35-
lib_deps =
36-
${common_env_data.lib_deps_embedded_external}
27+
build_flags =
28+
-Wl,-Teagle.flash.1m64.ld
29+
-DPIO_FRAMEWORK_ARDUINO_LWIP2_LOW_MEMORY
30+
-DRED_PIN=5
31+
-DGREEN_PIN=14
32+
-DBLUE_PIN=12
33+
-DWHITE1_PIN=13
34+
-DRF_PIN=3
35+
lib_deps = ${common_env_data.lib_deps_embedded_external}
3736
upload_speed = 115200
3837

39-
; 1) switch GPIO0 to GND
40-
; 2) Connect USB
41-
; 3) power
42-
; 5) flash
43-
; 6) gpio0 to off
44-
; 7) remove power
45-
; 8) remove usb
4638
[env:LC01_RGB]
4739
platform = espressif8266
4840
framework = arduino
4941
board = esp8285
5042
upload_resetmethod = nodemcu
5143
upload_protocol = espota
5244
board_build.flash_mode = dout
53-
build_flags =
54-
-Wl,-Teagle.flash.1m64.ld
55-
-DPIO_FRAMEWORK_ARDUINO_LWIP2_LOW_MEMORY
56-
-DRED_PIN=12
57-
-DGREEN_PIN=5
58-
-DBLUE_PIN=13
59-
-ARILUX_RED_PWM_RANGE=300
60-
lib_deps =
61-
${common_env_data.lib_deps_embedded_external}
45+
build_flags =
46+
-Wl,-Teagle.flash.1m64.ld
47+
-DPIO_FRAMEWORK_ARDUINO_LWIP2_LOW_MEMORY
48+
-DRED_PIN=12
49+
-DGREEN_PIN=5
50+
-DBLUE_PIN=13
51+
-ARILUX_RED_PWM_RANGE=300
52+
lib_deps = ${common_env_data.lib_deps_embedded_external}
6253
upload_speed = 115200
6354

64-
; 12,13,14,15,16
65-
; 0,1,2,3,4,5
6655
[env:LC10_new]
6756
platform = espressif8266
6857
framework = arduino
6958
board = esp8285
7059
upload_resetmethod = nodemcu
7160
upload_protocol = espota
7261
board_build.flash_mode = dout
73-
build_flags =
74-
-Wl,-Teagle.flash.1m64.ld
75-
-DPIO_FRAMEWORK_ARDUINO_LWIP2_LOW_MEMORY
76-
-DRF_REMOTE
77-
-DRF_PIN=4
78-
-DRED_PIN=12
79-
-DGREEN_PIN=5
80-
-DBLUE_PIN=13
81-
-DWHITE1_PIN=15
82-
lib_deps =
83-
${common_env_data.lib_deps_embedded_external}
62+
build_flags =
63+
-Wl,-Teagle.flash.1m64.ld
64+
-DPIO_FRAMEWORK_ARDUINO_LWIP2_LOW_MEMORY
65+
-DRF_REMOTE
66+
-DRF_PIN=4
67+
-DRED_PIN=12
68+
-DGREEN_PIN=5
69+
-DBLUE_PIN=13
70+
-DWHITE1_PIN=15
71+
lib_deps = ${common_env_data.lib_deps_embedded_external}
8472
upload_speed = 115200
8573

8674
[env:LC10_new_RGB_Switched]
@@ -90,34 +78,50 @@ board = esp8285
9078
upload_resetmethod = nodemcu
9179
upload_protocol = espota
9280
board_build.flash_mode = dout
93-
build_flags =
94-
-Wl,-Teagle.flash.1m64.ld
95-
-DPIO_FRAMEWORK_ARDUINO_LWIP2_LOW_MEMORY
96-
-DRF_REMOTE
97-
-DRF_PIN=4
98-
-DRED_PIN=5
99-
-DGREEN_PIN=12
100-
-DBLUE_PIN=13
101-
-DWHITE1_PIN=15
102-
-DUSE_LAST_HSB_STATE_AT_BOOT=1
103-
lib_deps =
104-
${common_env_data.lib_deps_embedded_external}
81+
build_flags =
82+
-Wl,-Teagle.flash.1m64.ld
83+
-DPIO_FRAMEWORK_ARDUINO_LWIP2_LOW_MEMORY
84+
-DRF_REMOTE
85+
-DRF_PIN=4
86+
-DRED_PIN=5
87+
-DGREEN_PIN=12
88+
-DBLUE_PIN=13
89+
-DWHITE1_PIN=15
90+
-DUSE_LAST_HSB_STATE_AT_BOOT=1
91+
lib_deps = ${common_env_data.lib_deps_embedded_external}
10592
upload_speed = 115200
10693

10794
[env:wemos]
10895
platform = espressif8266
10996
framework = arduino
110-
board = esp8285
97+
board = d1_mini
11198
upload_resetmethod = nodemcu
11299
#upload_protocol = espota
113100
board_build.flash_mode = dout
114-
build_flags =
115-
-DPIO_FRAMEWORK_ARDUINO_LWIP2_LOW_MEMORY
116-
-DRED_PIN=12
117-
-DGREEN_PIN=12
118-
-DBLUE_PIN=13
119-
-DWHITE1_PIN=15
120-
lib_deps =
121-
${common_env_data.lib_deps_embedded_external}
122-
#upload_speed = 921600
123-
#upload_speed = 460800
101+
#build_type = debug
102+
build_flags =
103+
-DPIO_FRAMEWORK_ARDUINO_LWIP2_LOW_MEMORY
104+
-DRED_PIN=15
105+
-DGREEN_PIN=13
106+
-DBLUE_PIN=12
107+
-DWHITE1_PIN=14
108+
-DWHITE2_PIN=4
109+
lib_deps = ${common_env_data.lib_deps_embedded_external}
110+
upload_speed = 921600
111+
112+
[env:H801]
113+
platform = espressif8266
114+
framework = arduino
115+
board = d1_mini_lite
116+
upload_resetmethod = nodemcu
117+
board_build.flash_mode = dout
118+
board_build.ldscript = eagle.flash.1m64.ld
119+
build_flags =
120+
-DPIO_FRAMEWORK_ARDUINO_LWIP2_LOW_MEMORY
121+
-DRED_PIN=15
122+
-DGREEN_PIN=13
123+
-DBLUE_PIN=12
124+
-DWHITE1_PIN=14
125+
-DWHITE2_PIN=4
126+
lib_deps = ${common_env_data.lib_deps_embedded_external}
127+
upload_speed = 921600

src/WifiManagerTypes.h

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#pragma once
2+
3+
#include <WiFiManager.h>
4+
5+
class IntParameter : public WiFiManagerParameter {
6+
public:
7+
IntParameter(const char *id, const char *placeholder, const char *custom, int labelPlacement)
8+
: WiFiManagerParameter("") {
9+
init(id, placeholder, "", 1, custom, labelPlacement);
10+
}
11+
12+
long getValue() {
13+
return atol(WiFiManagerParameter::getValue());
14+
}
15+
16+
void setValue(long value) {
17+
char buffer[10] = "";
18+
snprintf(buffer, sizeof(buffer), "%ld", value);
19+
WiFiManagerParameter::setValue(buffer, 10);
20+
}
21+
};
22+
23+
class BoolParameter : public WiFiManagerParameter {
24+
public:
25+
BoolParameter(const char *id, const char *placeholder, const char *custom, int labelPlacement)
26+
: WiFiManagerParameter("") {
27+
init(id, placeholder, "", 1, custom, labelPlacement);
28+
}
29+
30+
bool getValue() {
31+
return strcmp(WiFiManagerParameter::getValue(), "1")==0;
32+
}
33+
void setValue(bool val) {
34+
WiFiManagerParameter::setValue(val?"1":"", 2);
35+
}
36+
};

0 commit comments

Comments
 (0)