mirror of
https://github.com/anklimov/lighthub
synced 2025-12-06 03:39:49 +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
|
||||
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 -DOWIRE_DISABLE"
|
||||
#export FLAGS="$FLAGS -DDHT_DISABLE"
|
||||
export FLAGS="$FLAGS -DOWIRE_DISABLE"
|
||||
export FLAGS="$FLAGS -DDHT_DISABLE"
|
||||
export FLAGS="$FLAGS -DCOUNTER_DISABLE"
|
||||
#export FLAGS="$FLAGS -DM5STACK"
|
||||
#export FLAGS="$FLAGS -std=gnu++11"
|
||||
CUSTOM_BUILD_FLAGS_FILE=custom-build-flags/build_flags_esp32.sh
|
||||
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
|
||||
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 -DDMX_DISABLE"
|
||||
export FLAGS="$FLAGS -DMODBUS_DISABLE"
|
||||
|
||||
@@ -28,7 +28,7 @@ e-mail anklimov@gmail.com
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(ESP8266)
|
||||
#if defined(ESP8266) || defined(ARDUINO_ARCH_ESP32)
|
||||
#ifndef DMX_DISABLE
|
||||
DMXESPSerial dmxout;
|
||||
#endif
|
||||
|
||||
@@ -43,6 +43,12 @@ extern DMXESPSerial dmxout;
|
||||
#define DmxWrite dmxout.write
|
||||
#endif
|
||||
|
||||
#if defined(ARDUINO_ARCH_ESP32)
|
||||
#include <ESPDMX.h>
|
||||
extern DMXESPSerial dmxout;
|
||||
#define DmxWrite dmxout.write
|
||||
#endif
|
||||
|
||||
#if defined(__SAM3X8E__)
|
||||
#include <DmxDue.h>
|
||||
#define DmxWrite dmxout.write
|
||||
|
||||
@@ -134,8 +134,8 @@ int Input::poll(short cause) {
|
||||
|
||||
if (!isValid()) return -1;
|
||||
#ifndef CSSHDC_DISABLE
|
||||
in_ccs811 ccs811(this);
|
||||
in_hdc1080 hdc1080(this);
|
||||
in_ccs811 _ccs811(this);
|
||||
in_hdc1080 _hdc1080(this);
|
||||
#endif
|
||||
|
||||
switch (cause) {
|
||||
@@ -167,10 +167,10 @@ switch (cause) {
|
||||
{
|
||||
#ifndef CSSHDC_DISABLE
|
||||
case IN_CCS811:
|
||||
ccs811.Poll();
|
||||
_ccs811.Poll();
|
||||
break;
|
||||
case IN_HDC1080:
|
||||
hdc1080.Poll();
|
||||
_hdc1080.Poll();
|
||||
break;
|
||||
#endif
|
||||
#ifndef DHT_DISABLE
|
||||
|
||||
@@ -691,7 +691,7 @@ wifiManager.setTimeout(30);
|
||||
#ifdef W5500_CS_PIN
|
||||
Ethernet.w5500_cspin = W5500_CS_PIN;
|
||||
debugSerial<<F("Use W5500 pin: ");
|
||||
debugSerial<<(Ethernet.w5500_cspin);
|
||||
debugSerial<<(Ethernet.w5500_cspin)<<endl;
|
||||
#endif
|
||||
IPAddress ip, dns, gw, mask;
|
||||
int res = 1;
|
||||
@@ -1331,6 +1331,11 @@ void setup_main() {
|
||||
memset(&UniqueID,0,sizeof(UniqueID));
|
||||
#endif
|
||||
|
||||
#if defined(M5STACK)
|
||||
// Initialize the M5Stack object
|
||||
M5.begin();
|
||||
#endif
|
||||
|
||||
setupCmdArduino();
|
||||
printFirmwareVersionAndBuildOptions();
|
||||
|
||||
@@ -1557,6 +1562,11 @@ void setupCmdArduino() {
|
||||
}
|
||||
|
||||
void loop_main() {
|
||||
#if defined(M5STACK)
|
||||
// Initialize the M5Stack object
|
||||
M5.update();
|
||||
#endif
|
||||
|
||||
wdt_res();
|
||||
cmdPoll();
|
||||
if (lanLoop() > HAVE_IP_ADDRESS) {
|
||||
|
||||
@@ -1,6 +1,11 @@
|
||||
#pragma once
|
||||
|
||||
#include "options.h"
|
||||
|
||||
#if defined(M5STACK)
|
||||
#include <M5Stack.h>
|
||||
#endif
|
||||
|
||||
#if defined(__SAM3X8E__)
|
||||
#include <DueFlashStorage.h>
|
||||
#include <watchdog.h>
|
||||
|
||||
@@ -3,10 +3,14 @@
|
||||
#include "options.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;
|
||||
|
||||
static bool HDC1080ready = false;
|
||||
@@ -35,8 +39,16 @@ Wire.begin(); //Inialize I2C Harware
|
||||
printDriverError(returnCode);
|
||||
return 0;
|
||||
}
|
||||
ccs811.setBaseline(62000);
|
||||
//ccs811.setBaseline(62000);
|
||||
CCS811ready = true;
|
||||
|
||||
//returnCode = ccs811.setDriveMode(1);
|
||||
//printDriverError(returnCode);
|
||||
|
||||
delay(2000);Poll();
|
||||
delay(2000);Poll();
|
||||
delay(2000);Poll();
|
||||
delay(2000);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -81,6 +93,19 @@ if (reg!=0xff)
|
||||
Serial.print("C, RH=");
|
||||
Serial.print(h=hdc1080.readHumidity());
|
||||
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(h,"/H");
|
||||
if (CCS811ready) ccs811.setEnvironmentalData(h,t);
|
||||
@@ -99,8 +124,10 @@ int in_ccs811::Poll()
|
||||
#ifdef WAK_PIN
|
||||
digitalWrite(WAK_PIN,LOW);
|
||||
#endif
|
||||
delay(1);
|
||||
//Check to see if data is ready with .dataAvailable()
|
||||
if (ccs811.dataAvailable())
|
||||
//if (1)
|
||||
{
|
||||
//If so, have the sensor read and calculate the results.
|
||||
//Get them later
|
||||
@@ -117,6 +144,19 @@ int in_ccs811::Poll()
|
||||
Serial.print("] baseline[");
|
||||
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(tvoc,"/TVOC");
|
||||
publish(ccs811Baseline,"/base");
|
||||
|
||||
@@ -21,9 +21,10 @@
|
||||
#endif
|
||||
|
||||
#if defined (ARDUINO_ARCH_ESP32)
|
||||
#ifndef WAK_PIN
|
||||
#define WAK_PIN 17
|
||||
#endif
|
||||
#undef WAK_PIN
|
||||
//#ifndef WAK_PIN
|
||||
//#define WAK_PIN 17
|
||||
//#endif
|
||||
#endif
|
||||
|
||||
#if defined(ARDUINO_ARCH_AVR)
|
||||
|
||||
@@ -164,7 +164,11 @@
|
||||
#if defined(ARDUINO_ARCH_ESP32)
|
||||
#undef _dmxin
|
||||
#undef _modbus
|
||||
#undef _dmxout
|
||||
|
||||
#ifndef DMX_DISABLE
|
||||
#define _espdmx
|
||||
#endif
|
||||
//#undef _dmxout
|
||||
#undef modbusSerial
|
||||
#endif
|
||||
|
||||
@@ -189,6 +193,10 @@
|
||||
#define strncpy_P strncpy
|
||||
#endif
|
||||
|
||||
//#ifdef M5STACK
|
||||
//#define debugSerial M5.Lcd
|
||||
//#endif
|
||||
|
||||
#ifndef debugSerial
|
||||
#define debugSerial Serial
|
||||
#endif
|
||||
|
||||
@@ -17,11 +17,12 @@ env_default =
|
||||
; due
|
||||
; esp8266
|
||||
; esp32
|
||||
m5stack
|
||||
; megaatmega2560-5500
|
||||
; due-5500
|
||||
; controllino
|
||||
; stm32
|
||||
nrf52840
|
||||
; nrf52840
|
||||
|
||||
;build_dir = /tmp/pioenvs
|
||||
;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]
|
||||
platform = espressif32
|
||||
framework = arduino
|
||||
@@ -121,7 +169,8 @@ lib_deps =
|
||||
https://github.com/anklimov/ESP-Dmx
|
||||
FastLED
|
||||
ClosedCube HDC1080
|
||||
SparkFun CCS811 Arduino Library
|
||||
;SparkFun CCS811 Arduino Library
|
||||
https://github.com/sparkfun/SparkFun_CCS811_Arduino_Library.git
|
||||
[env:due]
|
||||
platform = atmelsam
|
||||
framework = arduino
|
||||
|
||||
Reference in New Issue
Block a user