changes, build and test script
This commit is contained in:
parent
dad092c087
commit
77187d0d46
10
.gitignore
vendored
10
.gitignore
vendored
@ -1,13 +1,7 @@
|
||||
/Release/
|
||||
.vscode/
|
||||
~*
|
||||
*~
|
||||
|
||||
# generated files, will be regenerated by CI script
|
||||
libraries/includes/configuration.cpp
|
||||
libraries/includes/configuration.h
|
||||
|
||||
# release targets, will be generated by CI script
|
||||
sketch.esp8266.esp8266.nodemcu.bin
|
||||
sketch.esp8266.esp8266.nodemcu.elf
|
||||
sketch/sketch.esp8266.esp8266.nodemcu.bin
|
||||
sketch/sketch.esp8266.esp8266.nodemcu.elf
|
||||
|
||||
|
36
build.sh
Executable file
36
build.sh
Executable file
@ -0,0 +1,36 @@
|
||||
#!/bin/bash
|
||||
|
||||
if [ "$1" == "" ]; then
|
||||
echo "Give one of the targets: build, clean, upload"
|
||||
echo "If you want to use a project directory different"
|
||||
echo "than the current directory, give it as a second"
|
||||
echo "argument."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ "$2" != "" ]; then
|
||||
PROJECT_DIR=$2
|
||||
else
|
||||
PROJECT_DIR=$PWD
|
||||
fi
|
||||
|
||||
|
||||
if [ "$1" == "build" ]; then
|
||||
pushd $PROJECT_DIR/libraries/esp8266boilerplate/ConfigGenerator && ./configGen.sh && popd
|
||||
env ARDUINO_SKETCHBOOK_DIR=$PROJECT_DIR arduino-cli compile --fqbn=esp8266:esp8266:nodemcu $PROJECT_DIR/sketch
|
||||
cp sketch/sketch.esp8266.esp8266.nodemcu.* .
|
||||
elif [ "$1" == "clean" ]; then
|
||||
for D in libraries/includes/configuration.h libraries/includes/configuration.cpp sketch/sketch.esp8266.esp8266.nodemcu.bin sketch/sketch.esp8266.esp8266.nodemcu.elf sketch.esp8266.esp8266.nodemcu.bin sketch.esp8266.esp8266.nodemcu.elf; do
|
||||
echo -n "About to delete $D ... "
|
||||
rm $PROJECT_DIR/$D && echo "done"
|
||||
done
|
||||
elif [ "$1" == "upload" ]; then
|
||||
echo "About to upload to device"
|
||||
esptool.py --port /dev/ttyUSB1 write_flash 0 sketch.esp8266.esp8266.nodemcu.bin
|
||||
else
|
||||
echo "Unknown subcommand '$1'"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
|
@ -41,7 +41,7 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define NUM_OF_LEDs 32
|
||||
#define NUM_OF_LEDs 300
|
||||
|
||||
|
||||
#endif /* DEFINES_H_ */
|
||||
|
@ -72,3 +72,11 @@ This approach can easily be implemented in a Gitlab CI script:
|
||||
|
||||
|
||||
|
||||
|
||||
### Uploading to the target
|
||||
|
||||
In a final step the CI script will put the generated firmware binary into the Gitlab release area.
|
||||
It can be downloaded there and uploaded to the device using the ``esptool.py``.
|
||||
|
||||
esptool.py -p /dev/ttyUSB0 write_flash 0x0 sketch.esp8266.esp8266.nodemcu.bin
|
||||
|
||||
|
@ -43,7 +43,7 @@ typedef struct {
|
||||
|
||||
|
||||
// Adafruit_NeoPixel pixels(NUM_OF_LEDs, PIXEL_PIN, NEO_RGB + NEO_KHZ400);
|
||||
Adafruit_NeoPixel pixels(NUM_OF_LEDs, PIXEL_PIN, NEO_RGB + NEO_KHZ800);
|
||||
Adafruit_NeoPixel pixels(NUM_OF_LEDs, PIXEL_PIN, NEO_GRB + NEO_KHZ800);
|
||||
#endif
|
||||
|
||||
bool show = false;
|
||||
@ -102,9 +102,9 @@ void subscribeApplication() {
|
||||
|
||||
|
||||
|
||||
static void setColor(int8_t ledNumber, uint8_t red, uint8_t green, uint8_t blue) {
|
||||
static void setColor(int16_t ledNumber, uint8_t red, uint8_t green, uint8_t blue) {
|
||||
if (ledNumber == -1) {
|
||||
for (uint8_t i = 0; i < NUM_OF_LEDs; i++) {
|
||||
for (uint16_t i = 0; i < NUM_OF_LEDs; i++) {
|
||||
#ifdef WS2811
|
||||
leds[i].r = red;
|
||||
leds[i].g = green;
|
||||
@ -194,7 +194,7 @@ void setupApplication() {
|
||||
#ifdef PL9823
|
||||
pixels.begin();
|
||||
|
||||
for (uint8_t i = 0; i < NUM_OF_LEDs; i++) {
|
||||
for (uint16_t i = 0; i < NUM_OF_LEDs; i++) {
|
||||
pixels.setPixelColor(i, pixels.Color(0,0,0));
|
||||
}
|
||||
pixels.show();
|
||||
|
23
test/test.py
Normal file
23
test/test.py
Normal file
@ -0,0 +1,23 @@
|
||||
import paho.mqtt.client as mqtt
|
||||
|
||||
RGB_TOPIC = 'IoT/RgbLedStripe/ColorCommand'
|
||||
|
||||
|
||||
client = mqtt.Client(client_id = 'test1')
|
||||
|
||||
client.connect("172.16.2.16", 1883, 60)
|
||||
|
||||
i = 0
|
||||
while True:
|
||||
client.loop()
|
||||
|
||||
i += 1
|
||||
if i == 300:
|
||||
i = 0
|
||||
client.publish(RGB_TOPIC, "{0} 0 0 255".format(i))
|
||||
client.publish(RGB_TOPIC, "{0} 0 255 0".format(i+1))
|
||||
client.publish(RGB_TOPIC, "{0} 255 0 0".format(i+2))
|
||||
client.publish(RGB_TOPIC, "{0} 0 0 0".format(i))
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user