mirror of
https://github.com/anklimov/lighthub
synced 2025-12-06 11:49:51 +03:00
M5STACK platform added
This commit is contained in:
7
check_custom_build_flags_esp32.sh
Executable file → Normal file
7
check_custom_build_flags_esp32.sh
Executable file → Normal file
@@ -1,10 +1,11 @@
|
|||||||
#! /bin/bash
|
#! /bin/bash
|
||||||
export FLAGS="$FLAGS -DPIO_SRC_REV="$(git log --pretty=format:%h_%ad -1 --date=short)
|
export FLAGS="$FLAGS -DPIO_SRC_REV="$(git log --pretty=format:%h_%ad -1 --date=short)
|
||||||
#export FLAGS="$FLAGS -DDMX_DISABLE"
|
export FLAGS="$FLAGS -DDMX_DISABLE"
|
||||||
export FLAGS="$FLAGS -DMODBUS_DISABLE"
|
export FLAGS="$FLAGS -DMODBUS_DISABLE"
|
||||||
#export FLAGS="$FLAGS -DOWIRE_DISABLE"
|
export FLAGS="$FLAGS -DOWIRE_DISABLE"
|
||||||
#export FLAGS="$FLAGS -DDHT_DISABLE"
|
export FLAGS="$FLAGS -DDHT_DISABLE"
|
||||||
export FLAGS="$FLAGS -DCOUNTER_DISABLE"
|
export FLAGS="$FLAGS -DCOUNTER_DISABLE"
|
||||||
|
#export FLAGS="$FLAGS -DM5STACK"
|
||||||
#export FLAGS="$FLAGS -std=gnu++11"
|
#export FLAGS="$FLAGS -std=gnu++11"
|
||||||
CUSTOM_BUILD_FLAGS_FILE=custom-build-flags/build_flags_esp32.sh
|
CUSTOM_BUILD_FLAGS_FILE=custom-build-flags/build_flags_esp32.sh
|
||||||
if [ -f $CUSTOM_BUILD_FLAGS_FILE ]; then
|
if [ -f $CUSTOM_BUILD_FLAGS_FILE ]; then
|
||||||
|
|||||||
1
check_custom_build_flags_nrf52840.sh
Executable file → Normal file
1
check_custom_build_flags_nrf52840.sh
Executable file → Normal file
@@ -1,5 +1,6 @@
|
|||||||
#! /bin/bash
|
#! /bin/bash
|
||||||
export FLAGS="$FLAGS -DWiz5500"
|
export FLAGS="$FLAGS -DWiz5500"
|
||||||
|
#export FLAGS="$FLAGS -DW5500_CS_PIN=10"
|
||||||
export FLAGS="$FLAGS -DPIO_SRC_REV="$(git log --pretty=format:%h_%ad -1 --date=short)
|
export FLAGS="$FLAGS -DPIO_SRC_REV="$(git log --pretty=format:%h_%ad -1 --date=short)
|
||||||
export FLAGS="$FLAGS -DDMX_DISABLE"
|
export FLAGS="$FLAGS -DDMX_DISABLE"
|
||||||
export FLAGS="$FLAGS -DMODBUS_DISABLE"
|
export FLAGS="$FLAGS -DMODBUS_DISABLE"
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ e-mail anklimov@gmail.com
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(ESP8266)
|
#if defined(ESP8266) || defined(ARDUINO_ARCH_ESP32)
|
||||||
#ifndef DMX_DISABLE
|
#ifndef DMX_DISABLE
|
||||||
DMXESPSerial dmxout;
|
DMXESPSerial dmxout;
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -43,6 +43,12 @@ extern DMXESPSerial dmxout;
|
|||||||
#define DmxWrite dmxout.write
|
#define DmxWrite dmxout.write
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(ARDUINO_ARCH_ESP32)
|
||||||
|
#include <ESPDMX.h>
|
||||||
|
extern DMXESPSerial dmxout;
|
||||||
|
#define DmxWrite dmxout.write
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(__SAM3X8E__)
|
#if defined(__SAM3X8E__)
|
||||||
#include <DmxDue.h>
|
#include <DmxDue.h>
|
||||||
#define DmxWrite dmxout.write
|
#define DmxWrite dmxout.write
|
||||||
|
|||||||
@@ -134,8 +134,8 @@ int Input::poll(short cause) {
|
|||||||
|
|
||||||
if (!isValid()) return -1;
|
if (!isValid()) return -1;
|
||||||
#ifndef CSSHDC_DISABLE
|
#ifndef CSSHDC_DISABLE
|
||||||
in_ccs811 ccs811(this);
|
in_ccs811 _ccs811(this);
|
||||||
in_hdc1080 hdc1080(this);
|
in_hdc1080 _hdc1080(this);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
switch (cause) {
|
switch (cause) {
|
||||||
@@ -167,10 +167,10 @@ switch (cause) {
|
|||||||
{
|
{
|
||||||
#ifndef CSSHDC_DISABLE
|
#ifndef CSSHDC_DISABLE
|
||||||
case IN_CCS811:
|
case IN_CCS811:
|
||||||
ccs811.Poll();
|
_ccs811.Poll();
|
||||||
break;
|
break;
|
||||||
case IN_HDC1080:
|
case IN_HDC1080:
|
||||||
hdc1080.Poll();
|
_hdc1080.Poll();
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
#ifndef DHT_DISABLE
|
#ifndef DHT_DISABLE
|
||||||
|
|||||||
@@ -691,7 +691,7 @@ wifiManager.setTimeout(30);
|
|||||||
#ifdef W5500_CS_PIN
|
#ifdef W5500_CS_PIN
|
||||||
Ethernet.w5500_cspin = W5500_CS_PIN;
|
Ethernet.w5500_cspin = W5500_CS_PIN;
|
||||||
debugSerial<<F("Use W5500 pin: ");
|
debugSerial<<F("Use W5500 pin: ");
|
||||||
debugSerial<<(Ethernet.w5500_cspin);
|
debugSerial<<(Ethernet.w5500_cspin)<<endl;
|
||||||
#endif
|
#endif
|
||||||
IPAddress ip, dns, gw, mask;
|
IPAddress ip, dns, gw, mask;
|
||||||
int res = 1;
|
int res = 1;
|
||||||
@@ -1331,6 +1331,11 @@ void setup_main() {
|
|||||||
memset(&UniqueID,0,sizeof(UniqueID));
|
memset(&UniqueID,0,sizeof(UniqueID));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(M5STACK)
|
||||||
|
// Initialize the M5Stack object
|
||||||
|
M5.begin();
|
||||||
|
#endif
|
||||||
|
|
||||||
setupCmdArduino();
|
setupCmdArduino();
|
||||||
printFirmwareVersionAndBuildOptions();
|
printFirmwareVersionAndBuildOptions();
|
||||||
|
|
||||||
@@ -1557,6 +1562,11 @@ void setupCmdArduino() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void loop_main() {
|
void loop_main() {
|
||||||
|
#if defined(M5STACK)
|
||||||
|
// Initialize the M5Stack object
|
||||||
|
M5.update();
|
||||||
|
#endif
|
||||||
|
|
||||||
wdt_res();
|
wdt_res();
|
||||||
cmdPoll();
|
cmdPoll();
|
||||||
if (lanLoop() > HAVE_IP_ADDRESS) {
|
if (lanLoop() > HAVE_IP_ADDRESS) {
|
||||||
|
|||||||
@@ -1,6 +1,11 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "options.h"
|
#include "options.h"
|
||||||
|
|
||||||
|
#if defined(M5STACK)
|
||||||
|
#include <M5Stack.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(__SAM3X8E__)
|
#if defined(__SAM3X8E__)
|
||||||
#include <DueFlashStorage.h>
|
#include <DueFlashStorage.h>
|
||||||
#include <watchdog.h>
|
#include <watchdog.h>
|
||||||
|
|||||||
@@ -3,10 +3,14 @@
|
|||||||
#include "options.h"
|
#include "options.h"
|
||||||
#include "Streaming.h"
|
#include "Streaming.h"
|
||||||
|
|
||||||
#ifndef CSSHDC_DISABLE
|
#if defined(M5STACK)
|
||||||
|
#include <M5Stack.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef CSSHDC_DISABLE
|
||||||
|
static ClosedCube_HDC1080 hdc1080;
|
||||||
|
static CCS811 ccs811(CCS811_ADDR);
|
||||||
|
|
||||||
CCS811 ccs811(CCS811_ADDR);
|
|
||||||
ClosedCube_HDC1080 hdc1080;
|
|
||||||
long ccs811Baseline;
|
long ccs811Baseline;
|
||||||
|
|
||||||
static bool HDC1080ready = false;
|
static bool HDC1080ready = false;
|
||||||
@@ -35,8 +39,16 @@ Wire.begin(); //Inialize I2C Harware
|
|||||||
printDriverError(returnCode);
|
printDriverError(returnCode);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
ccs811.setBaseline(62000);
|
//ccs811.setBaseline(62000);
|
||||||
CCS811ready = true;
|
CCS811ready = true;
|
||||||
|
|
||||||
|
//returnCode = ccs811.setDriveMode(1);
|
||||||
|
//printDriverError(returnCode);
|
||||||
|
|
||||||
|
delay(2000);Poll();
|
||||||
|
delay(2000);Poll();
|
||||||
|
delay(2000);Poll();
|
||||||
|
delay(2000);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -81,6 +93,19 @@ if (reg!=0xff)
|
|||||||
Serial.print("C, RH=");
|
Serial.print("C, RH=");
|
||||||
Serial.print(h=hdc1080.readHumidity());
|
Serial.print(h=hdc1080.readHumidity());
|
||||||
Serial.println("%");
|
Serial.println("%");
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef M5STACK
|
||||||
|
M5.Lcd.print(" T=");
|
||||||
|
//Returns calculated CO2 reading
|
||||||
|
M5.Lcd.print(t=hdc1080.readTemperature());
|
||||||
|
M5.Lcd.print("C, RH=");
|
||||||
|
//Returns calculated TVOC reading
|
||||||
|
|
||||||
|
M5.Lcd.print(h=hdc1080.readHumidity());
|
||||||
|
M5.Lcd.print("%\n");
|
||||||
|
#endif
|
||||||
|
|
||||||
publish(t,"/T");
|
publish(t,"/T");
|
||||||
publish(h,"/H");
|
publish(h,"/H");
|
||||||
if (CCS811ready) ccs811.setEnvironmentalData(h,t);
|
if (CCS811ready) ccs811.setEnvironmentalData(h,t);
|
||||||
@@ -99,8 +124,10 @@ int in_ccs811::Poll()
|
|||||||
#ifdef WAK_PIN
|
#ifdef WAK_PIN
|
||||||
digitalWrite(WAK_PIN,LOW);
|
digitalWrite(WAK_PIN,LOW);
|
||||||
#endif
|
#endif
|
||||||
|
delay(1);
|
||||||
//Check to see if data is ready with .dataAvailable()
|
//Check to see if data is ready with .dataAvailable()
|
||||||
if (ccs811.dataAvailable())
|
if (ccs811.dataAvailable())
|
||||||
|
//if (1)
|
||||||
{
|
{
|
||||||
//If so, have the sensor read and calculate the results.
|
//If so, have the sensor read and calculate the results.
|
||||||
//Get them later
|
//Get them later
|
||||||
@@ -117,6 +144,19 @@ int in_ccs811::Poll()
|
|||||||
Serial.print("] baseline[");
|
Serial.print("] baseline[");
|
||||||
Serial.print(ccs811Baseline = ccs811.getBaseline());
|
Serial.print(ccs811Baseline = ccs811.getBaseline());
|
||||||
|
|
||||||
|
#ifdef M5STACK
|
||||||
|
M5.Lcd.print(" CO2[");
|
||||||
|
//Returns calculated CO2 reading
|
||||||
|
M5.Lcd.print(co2 = ccs811.getCO2());
|
||||||
|
M5.Lcd.print("] tVOC[");
|
||||||
|
//Returns calculated TVOC reading
|
||||||
|
|
||||||
|
M5.Lcd.print(tvoc = ccs811.getTVOC());
|
||||||
|
M5.Lcd.print("]\n");
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
publish(co2,"/CO2");
|
publish(co2,"/CO2");
|
||||||
publish(tvoc,"/TVOC");
|
publish(tvoc,"/TVOC");
|
||||||
publish(ccs811Baseline,"/base");
|
publish(ccs811Baseline,"/base");
|
||||||
|
|||||||
@@ -21,9 +21,10 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined (ARDUINO_ARCH_ESP32)
|
#if defined (ARDUINO_ARCH_ESP32)
|
||||||
#ifndef WAK_PIN
|
#undef WAK_PIN
|
||||||
#define WAK_PIN 17
|
//#ifndef WAK_PIN
|
||||||
#endif
|
//#define WAK_PIN 17
|
||||||
|
//#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(ARDUINO_ARCH_AVR)
|
#if defined(ARDUINO_ARCH_AVR)
|
||||||
|
|||||||
@@ -164,7 +164,11 @@
|
|||||||
#if defined(ARDUINO_ARCH_ESP32)
|
#if defined(ARDUINO_ARCH_ESP32)
|
||||||
#undef _dmxin
|
#undef _dmxin
|
||||||
#undef _modbus
|
#undef _modbus
|
||||||
#undef _dmxout
|
|
||||||
|
#ifndef DMX_DISABLE
|
||||||
|
#define _espdmx
|
||||||
|
#endif
|
||||||
|
//#undef _dmxout
|
||||||
#undef modbusSerial
|
#undef modbusSerial
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -189,6 +193,10 @@
|
|||||||
#define strncpy_P strncpy
|
#define strncpy_P strncpy
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
//#ifdef M5STACK
|
||||||
|
//#define debugSerial M5.Lcd
|
||||||
|
//#endif
|
||||||
|
|
||||||
#ifndef debugSerial
|
#ifndef debugSerial
|
||||||
#define debugSerial Serial
|
#define debugSerial Serial
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -17,11 +17,12 @@ env_default =
|
|||||||
; due
|
; due
|
||||||
; esp8266
|
; esp8266
|
||||||
; esp32
|
; esp32
|
||||||
|
m5stack
|
||||||
; megaatmega2560-5500
|
; megaatmega2560-5500
|
||||||
; due-5500
|
; due-5500
|
||||||
; controllino
|
; controllino
|
||||||
; stm32
|
; stm32
|
||||||
nrf52840
|
; nrf52840
|
||||||
|
|
||||||
;build_dir = /tmp/pioenvs
|
;build_dir = /tmp/pioenvs
|
||||||
;libdeps_dir = /tmp/piolibdeps
|
;libdeps_dir = /tmp/piolibdeps
|
||||||
@@ -78,6 +79,53 @@ lib_deps =
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
[env:m5stack]
|
||||||
|
platform = espressif32
|
||||||
|
board = m5stack-core-esp32
|
||||||
|
framework = arduino
|
||||||
|
upload_speed = 921600
|
||||||
|
targets = upload
|
||||||
|
build_flags = !bash check_custom_build_flags_esp32.sh
|
||||||
|
lib_ignore =
|
||||||
|
DmxSimple
|
||||||
|
DMXSerial
|
||||||
|
DmxDue
|
||||||
|
DueFlashStorage
|
||||||
|
SD
|
||||||
|
SdFat
|
||||||
|
Ethernet
|
||||||
|
Ethernet2
|
||||||
|
Ethernet3
|
||||||
|
EEPROM
|
||||||
|
Artnet
|
||||||
|
UIPEthernet
|
||||||
|
ESP_EEPROM
|
||||||
|
httpClient
|
||||||
|
HttpClient_ID66
|
||||||
|
HttpClient
|
||||||
|
ArduinoHttpClient
|
||||||
|
lib_deps =
|
||||||
|
https://github.com/ebenolson/WIFIMANAGER-ESP32.git
|
||||||
|
https://github.com/zhouhan0126/WebServer-esp32.git
|
||||||
|
https://github.com/anklimov/aJson
|
||||||
|
https://github.com/anklimov/CmdArduino
|
||||||
|
https://github.com/knolleary/pubsubclient.git
|
||||||
|
Streaming
|
||||||
|
;ESP_EEPROM
|
||||||
|
https://github.com/anklimov/NRFFlashStorage
|
||||||
|
Adafruit Unified Sensor
|
||||||
|
DHT sensor library for ESPx
|
||||||
|
https://github.com/anklimov/Artnet.git
|
||||||
|
https://github.com/anklimov/ModbusMaster
|
||||||
|
https://github.com/anklimov/Arduino-Temperature-Control-Library.git
|
||||||
|
https://github.com/anklimov/DS2482_OneWire
|
||||||
|
https://github.com/anklimov/ESP-Dmx
|
||||||
|
FastLED
|
||||||
|
ClosedCube HDC1080
|
||||||
|
;SparkFun CCS811 Arduino Library
|
||||||
|
https://github.com/sparkfun/SparkFun_CCS811_Arduino_Library.git
|
||||||
|
M5Stack
|
||||||
|
|
||||||
[env:esp32]
|
[env:esp32]
|
||||||
platform = espressif32
|
platform = espressif32
|
||||||
framework = arduino
|
framework = arduino
|
||||||
@@ -121,7 +169,8 @@ lib_deps =
|
|||||||
https://github.com/anklimov/ESP-Dmx
|
https://github.com/anklimov/ESP-Dmx
|
||||||
FastLED
|
FastLED
|
||||||
ClosedCube HDC1080
|
ClosedCube HDC1080
|
||||||
SparkFun CCS811 Arduino Library
|
;SparkFun CCS811 Arduino Library
|
||||||
|
https://github.com/sparkfun/SparkFun_CCS811_Arduino_Library.git
|
||||||
[env:due]
|
[env:due]
|
||||||
platform = atmelsam
|
platform = atmelsam
|
||||||
framework = arduino
|
framework = arduino
|
||||||
|
|||||||
Reference in New Issue
Block a user