update
This commit is contained in:
parent
e35a4f96e5
commit
98ec91b7a3
|
|
@ -1,25 +1,19 @@
|
||||||
.pioenvs
|
.pioenvs
|
||||||
|
.clang_complete
|
||||||
|
.gcc-flags.json
|
||||||
.piolibdeps
|
.piolibdeps
|
||||||
*~
|
*~
|
||||||
|
|
||||||
# Ignore list for Eagle, a PCB layout tool
|
# Ignore list for Eagle, a PCB layout tool
|
||||||
|
|
||||||
# Backup files
|
# Backup files
|
||||||
*.s#?
|
*.s#?
|
||||||
*.b#?
|
*.b#?
|
||||||
*.l#?
|
*.l#?
|
||||||
|
|
||||||
|
|
||||||
# file locks introduced since 7.x
|
# file locks introduced since 7.x
|
||||||
*.lck
|
*.lck
|
||||||
|
|
||||||
|
|
||||||
# OS generated files #
|
# OS generated files #
|
||||||
######################
|
######################
|
||||||
.DS_Store
|
.DS_Store
|
||||||
ehthumbs.db
|
ehthumbs.db
|
||||||
Icon?
|
Icon?
|
||||||
Thumbs.db
|
Thumbs.db
|
||||||
*/overlays
|
*/overlays
|
||||||
*~
|
|
||||||
|
|
||||||
|
|
@ -0,0 +1,36 @@
|
||||||
|
|
||||||
|
This directory is intended for the project specific (private) libraries.
|
||||||
|
PlatformIO will compile them to static libraries and link to executable file.
|
||||||
|
|
||||||
|
The source code of each library should be placed in separate directory, like
|
||||||
|
"lib/private_lib/[here are source files]".
|
||||||
|
|
||||||
|
For example, see how can be organized `Foo` and `Bar` libraries:
|
||||||
|
|
||||||
|
|--lib
|
||||||
|
| |--Bar
|
||||||
|
| | |--docs
|
||||||
|
| | |--examples
|
||||||
|
| | |--src
|
||||||
|
| | |- Bar.c
|
||||||
|
| | |- Bar.h
|
||||||
|
| |--Foo
|
||||||
|
| | |- Foo.c
|
||||||
|
| | |- Foo.h
|
||||||
|
| |- readme.txt --> THIS FILE
|
||||||
|
|- platformio.ini
|
||||||
|
|--src
|
||||||
|
|- main.c
|
||||||
|
|
||||||
|
Then in `src/main.c` you should use:
|
||||||
|
|
||||||
|
#include <Foo.h>
|
||||||
|
#include <Bar.h>
|
||||||
|
|
||||||
|
// rest H/C/CPP code
|
||||||
|
|
||||||
|
PlatformIO will find your libraries automatically, configure preprocessor's
|
||||||
|
include paths and build them.
|
||||||
|
|
||||||
|
More information about PlatformIO Library Dependency Finder
|
||||||
|
- http://docs.platformio.org/en/stable/librarymanager/ldf.html
|
||||||
|
|
@ -18,15 +18,51 @@
|
||||||
# targets = upload
|
# targets = upload
|
||||||
|
|
||||||
[platformio]
|
[platformio]
|
||||||
src_dir = src
|
env_default = emonth2
|
||||||
|
|
||||||
|
[common]
|
||||||
|
lib_deps_external =
|
||||||
|
DHT sensor library @1.2.3
|
||||||
|
DallasTemperature @3.7.7
|
||||||
|
JeeLib @c057b5f4c0
|
||||||
|
SI7021 @c5ce0922ef
|
||||||
|
|
||||||
[env:emonth2]
|
[env:emonth2]
|
||||||
platform = atmelavr
|
platform = atmelavr
|
||||||
framework = arduino
|
framework = arduino
|
||||||
board = uno
|
board = uno
|
||||||
lib_install = 19, 54, 252, 536
|
lib_deps = ${common.lib_deps_external}
|
||||||
|
|
||||||
# [ 19 ] Adafruit-DHT
|
[env:isp]
|
||||||
# [ 54 ] DallasTemperature
|
# upload using isp
|
||||||
# [ 252 ] JeeLib
|
# $ pio run -t program -e isp
|
||||||
# [ 536 ] https://github.com/LowPowerLab/SI7021
|
platform = atmelavr
|
||||||
|
framework = arduino
|
||||||
|
board = uno
|
||||||
|
lib_deps = ${common.lib_deps_external}
|
||||||
|
upload_protocol = stk500v2
|
||||||
|
upload_flags = -Pusb
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
[common]
|
||||||
|
build_flags = -D BUILD_TAG=2.5.0
|
||||||
|
|
||||||
|
# http://docs.platformio.org/en/stable/projectconf.html#lib-deps
|
||||||
|
lib_deps_external =
|
||||||
|
DallasTemperature @3.7.7
|
||||||
|
EmonLib
|
||||||
|
JeeLib@c057b5f4c0
|
||||||
|
|
||||||
|
[env:emontx]
|
||||||
|
platform = atmelavr
|
||||||
|
framework = arduino
|
||||||
|
board = uno
|
||||||
|
build_flags = ${common.build_flags}
|
||||||
|
|
||||||
|
[env:emontx_deploy]
|
||||||
|
platform = atmelavr
|
||||||
|
framework = arduino
|
||||||
|
board = uno
|
||||||
|
lib_deps = ${common.lib_deps_external}
|
||||||
|
build_flags = !echo '-DBUILD_TAG='$TRAVIS_TAG
|
||||||
|
|
|
||||||
28
src/src.ino
28
src/src.ino
|
|
@ -46,7 +46,7 @@
|
||||||
-------------------------------------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------------------------------------
|
||||||
emonhub.conf node decoder:
|
emonhub.conf node decoder:
|
||||||
See: https://github.com/openenergymonitor/emonhub/blob/emon-pi/configuration.md
|
See: https://github.com/openenergymonitor/emonhub/blob/emon-pi/configuration.md
|
||||||
|
|
||||||
[[23]]
|
[[23]]
|
||||||
nodename = emonTH_5
|
nodename = emonTH_5
|
||||||
firmware = V2.x_emonTH_DHT22_DS18B20_RFM69CW_Pulse
|
firmware = V2.x_emonTH_DHT22_DS18B20_RFM69CW_Pulse
|
||||||
|
|
@ -175,7 +175,7 @@ void setup() {
|
||||||
rf12_sleep(RF12_SLEEP);
|
rf12_sleep(RF12_SLEEP);
|
||||||
if (debug==1)
|
if (debug==1)
|
||||||
{
|
{
|
||||||
Serial.begin(9600);
|
Serial.begin(115200);
|
||||||
Serial.print(DIP1); Serial.println(DIP2);
|
Serial.print(DIP1); Serial.println(DIP2);
|
||||||
Serial.println("OpenEnergyMonitor.org");
|
Serial.println("OpenEnergyMonitor.org");
|
||||||
Serial.print("emonTH - Firmware V"); Serial.println(version*0.1);
|
Serial.print("emonTH - Firmware V"); Serial.println(version*0.1);
|
||||||
|
|
@ -275,8 +275,8 @@ void setup() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (debug==1) delay(200);
|
if (debug==1) delay(200);
|
||||||
|
|
||||||
|
|
||||||
//################################################################################################################################
|
//################################################################################################################################
|
||||||
// Interrupt pulse counting setup
|
// Interrupt pulse counting setup
|
||||||
//################################################################################################################################
|
//################################################################################################################################
|
||||||
|
|
@ -291,7 +291,7 @@ void setup() {
|
||||||
p = 0;
|
p = 0;
|
||||||
|
|
||||||
attachInterrupt(pulse_countINT, onPulse, RISING);
|
attachInterrupt(pulse_countINT, onPulse, RISING);
|
||||||
|
|
||||||
//################################################################################################################################
|
//################################################################################################################################
|
||||||
// Power Save - turn off what we don't need - http://www.nongnu.org/avr-libc/user-manual/group__avr__power.html
|
// Power Save - turn off what we don't need - http://www.nongnu.org/avr-libc/user-manual/group__avr__power.html
|
||||||
//################################################################################################################################
|
//################################################################################################################################
|
||||||
|
|
@ -301,7 +301,7 @@ void setup() {
|
||||||
// power_timer0_disable(); //don't disable necessary for the DS18B20 library
|
// power_timer0_disable(); //don't disable necessary for the DS18B20 library
|
||||||
power_timer1_disable();
|
power_timer1_disable();
|
||||||
power_spi_disable();
|
power_spi_disable();
|
||||||
|
|
||||||
} // end of setup
|
} // end of setup
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -369,7 +369,7 @@ void loop()
|
||||||
|
|
||||||
|
|
||||||
power_spi_enable();
|
power_spi_enable();
|
||||||
|
|
||||||
// Read from SI7021 SPI temp & humidity sensor
|
// Read from SI7021 SPI temp & humidity sensor
|
||||||
if (SI7021_status==1){
|
if (SI7021_status==1){
|
||||||
si7021_env data = SI7021_sensor.getHumidityAndTemperature();
|
si7021_env data = SI7021_sensor.getHumidityAndTemperature();
|
||||||
|
|
@ -377,8 +377,8 @@ void loop()
|
||||||
emonth.humidity = data.humidityBasisPoints;
|
emonth.humidity = data.humidityBasisPoints;
|
||||||
// might nee dome delay here
|
// might nee dome delay here
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Send data via RF
|
// Send data via RF
|
||||||
rf12_sleep(RF12_WAKEUP);
|
rf12_sleep(RF12_WAKEUP);
|
||||||
dodelay(100);
|
dodelay(100);
|
||||||
|
|
@ -392,11 +392,11 @@ void loop()
|
||||||
//digitalWrite(LED,HIGH);
|
//digitalWrite(LED,HIGH);
|
||||||
//dodelay(100);
|
//dodelay(100);
|
||||||
//digitalWrite(LED,LOW);
|
//digitalWrite(LED,LOW);
|
||||||
|
|
||||||
if (debug==1)
|
if (debug==1)
|
||||||
{
|
{
|
||||||
Serial.print("temp:");Serial.print(emonth.temp); Serial.print(",");
|
Serial.print("temp:");Serial.print(emonth.temp); Serial.print(",");
|
||||||
|
|
||||||
if (((DHT22_status) || (SI7021_status)) && (DS18B20)){ // DS18b230 + other sensor = assume ds18b20 is external
|
if (((DHT22_status) || (SI7021_status)) && (DS18B20)){ // DS18b230 + other sensor = assume ds18b20 is external
|
||||||
Serial.print("temp_ex:");Serial.print(emonth.temp_external); Serial.print(",");
|
Serial.print("temp_ex:");Serial.print(emonth.temp_external); Serial.print(",");
|
||||||
}
|
}
|
||||||
|
|
@ -411,8 +411,8 @@ void loop()
|
||||||
}
|
}
|
||||||
delay(50);
|
delay(50);
|
||||||
} // end serial print debug
|
} // end serial print debug
|
||||||
|
|
||||||
|
|
||||||
unsigned long last = now;
|
unsigned long last = now;
|
||||||
now = millis();
|
now = millis();
|
||||||
WDT_number=0;
|
WDT_number=0;
|
||||||
|
|
@ -441,4 +441,4 @@ void onPulse()
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // IMPORTANT LINE! end unit test
|
#endif // IMPORTANT LINE! end unit test
|
||||||
//http://docs.platformio.org/en/stable/plus/unit-testing.html
|
//http://docs.platformio.org/en/stable/plus/unit-testing.html
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue