This commit is contained in:
Glyn Hudson 2016-09-24 19:26:30 +01:00
parent e35a4f96e5
commit 98ec91b7a3
4 changed files with 95 additions and 29 deletions

12
.gitignore vendored
View File

@ -1,25 +1,19 @@
.pioenvs
.clang_complete
.gcc-flags.json
.piolibdeps
*~
# Ignore list for Eagle, a PCB layout tool
# Backup files
*.s#?
*.b#?
*.l#?
# file locks introduced since 7.x
*.lck
# OS generated files #
######################
.DS_Store
ehthumbs.db
Icon?
Thumbs.db
*/overlays
*~
*/overlays

36
lib/readme.txt Normal file
View File

@ -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

View File

@ -18,15 +18,51 @@
# targets = upload
[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]
platform = atmelavr
framework = arduino
board = uno
lib_install = 19, 54, 252, 536
lib_deps = ${common.lib_deps_external}
# [ 19 ] Adafruit-DHT
# [ 54 ] DallasTemperature
# [ 252 ] JeeLib
# [ 536 ] https://github.com/LowPowerLab/SI7021
[env:isp]
# upload using isp
# $ pio run -t program -e isp
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

View File

@ -46,7 +46,7 @@
-------------------------------------------------------------------------------------------------------------
emonhub.conf node decoder:
See: https://github.com/openenergymonitor/emonhub/blob/emon-pi/configuration.md
[[23]]
nodename = emonTH_5
firmware = V2.x_emonTH_DHT22_DS18B20_RFM69CW_Pulse
@ -175,7 +175,7 @@ void setup() {
rf12_sleep(RF12_SLEEP);
if (debug==1)
{
Serial.begin(9600);
Serial.begin(115200);
Serial.print(DIP1); Serial.println(DIP2);
Serial.println("OpenEnergyMonitor.org");
Serial.print("emonTH - Firmware V"); Serial.println(version*0.1);
@ -275,8 +275,8 @@ void setup() {
}
}
if (debug==1) delay(200);
//################################################################################################################################
// Interrupt pulse counting setup
//################################################################################################################################
@ -291,7 +291,7 @@ void setup() {
p = 0;
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
//################################################################################################################################
@ -301,7 +301,7 @@ void setup() {
// power_timer0_disable(); //don't disable necessary for the DS18B20 library
power_timer1_disable();
power_spi_disable();
} // end of setup
@ -369,7 +369,7 @@ void loop()
power_spi_enable();
// Read from SI7021 SPI temp & humidity sensor
if (SI7021_status==1){
si7021_env data = SI7021_sensor.getHumidityAndTemperature();
@ -377,8 +377,8 @@ void loop()
emonth.humidity = data.humidityBasisPoints;
// might nee dome delay here
}
// Send data via RF
rf12_sleep(RF12_WAKEUP);
dodelay(100);
@ -392,11 +392,11 @@ void loop()
//digitalWrite(LED,HIGH);
//dodelay(100);
//digitalWrite(LED,LOW);
if (debug==1)
{
Serial.print("temp:");Serial.print(emonth.temp); Serial.print(",");
if (((DHT22_status) || (SI7021_status)) && (DS18B20)){ // DS18b230 + other sensor = assume ds18b20 is external
Serial.print("temp_ex:");Serial.print(emonth.temp_external); Serial.print(",");
}
@ -411,8 +411,8 @@ void loop()
}
delay(50);
} // end serial print debug
unsigned long last = now;
now = millis();
WDT_number=0;
@ -441,4 +441,4 @@ void onPulse()
}
#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