Updated build

This commit is contained in:
mercdev 2018-02-20 00:44:16 -07:00
parent 53208b5ad7
commit c94a073239
21 changed files with 640 additions and 633 deletions

View File

@ -1,2 +1,2 @@
Connecting to https://mongoose.cloud, user test
Uploading sources (2437 bytes)
Uploading sources (2968 bytes)

File diff suppressed because one or more lines are too long

View File

@ -107,9 +107,8 @@
"deviceId": "",
"temperature": 0.0,
"humidity": 0.0,
"light": 0,
"statuslight": 0,
"moisture": 0,
"connected": false,
"battery_calibration": 2360
"connected": false
}
}

View File

@ -10,32 +10,32 @@ load('api_dht.js');
load('api_adc.js');
load('api_rpc.js');
//Pins
let ResetPin = 0;
let LedPin = 16;
let DHTpin = 22;
let SOILpin = 32;
let LIGHTpin = 34;
// Pins
let resetPin = 0;
let statusLightPin = 16;
let dhtPin = 22;
let moisturePin = 32;
let lightPin = 34;
// Turn on status led
GPIO.set_mode(LedPin, GPIO.MODE_OUTPUT);
GPIO.write(LedPin, 0);
GPIO.set_mode(statusLightPin, GPIO.MODE_OUTPUT);
GPIO.write(statusLightPin, 0);
//Reset Handler
GPIO.set_mode(ResetPin, GPIO.MODE_INPUT);
GPIO.set_int_handler(ResetPin, GPIO.INT_EDGE_NEG, function(ResetPin) {
print('Pin', ResetPin, 'got interrupt');
GPIO.toggle(LedPin);
// Reset Handler
GPIO.set_mode(resetPin, GPIO.MODE_INPUT);
GPIO.set_int_handler(resetPin, GPIO.INT_EDGE_NEG, function(resetPin) {
print('Pin', resetPin, 'got interrupt');
GPIO.toggle(statusLightPin);
Sys.usleep(200000);
GPIO.toggle(LedPin);
GPIO.toggle(statusLightPin);
Sys.usleep(200000);
GPIO.toggle(LedPin);
GPIO.toggle(statusLightPin);
Sys.usleep(200000);
GPIO.toggle(LedPin);
GPIO.toggle(statusLightPin);
Sys.usleep(200000);
GPIO.toggle(LedPin);
GPIO.toggle(statusLightPin);
Sys.usleep(200000);
GPIO.write(LedPin, 0);
GPIO.write(statusLightPin, 0);
Cfg.set({bt:{enable:true}});
Cfg.set({wifi:{sta:{enable:false}}});
@ -44,37 +44,81 @@ GPIO.set_int_handler(ResetPin, GPIO.INT_EDGE_NEG, function(ResetPin) {
Sys.reboot(1000);
}, null);
GPIO.enable_int(ResetPin);
GPIO.enable_int(resetPin);
ADC.enable(SOILpin);
let dht = DHT.create(DHTpin, DHT.DHT11);
let deviceId = Cfg.get("higrow.deviceId");
if (deviceId === "")
{
deviceId = Cfg.get("device.id");
Cfg.set("higrow.devideId", deviceId);
}
ADC.enable(moisturePin);
let dht = DHT.create(dhtPin, DHT.DHT11);
let deviceId = Cfg.get("device.id");
let connected = false;
let readSensors = Timer.set(15000, Timer.REPEAT, function() {
let readSensors = Timer.set(5000, Timer.REPEAT, function() {
let t = dht.getTemp();
let h = dht.getHumidity();
let m = ADC.read(SOILpin);
let l = ADC.read(LIGHTpin);
let m = ADC.read(moisturePin);
let l = ADC.read(lightPin);
print("DeviceId:", deviceId,"Temperature:",t,"Humidity:",h,"Moisture:",m,"Light:",l);
print("DeviceId:",deviceId,"Temperature:",t,"Humidity:",h,"Moisture:",m,"Light:",l);
if (deviceId !== "" && connected)
{
GPIO.write(statusLightPin, 1);
let jsonData = {'DeviceId': deviceId, 'Temperature': t, 'Humidity': h, 'Moisture': m, 'Light': l};
HTTP.query({
headers: {'Content-Type' : 'application/json'},
url: 'http://httpbin.org/post', // replace with your own endpoint
data: jsonData,
success: function(body, full_http_msg)
{
//print(body);
// sleep for 15 seconds, then (re)boot up and do it all over again
//ESP32.deepSleep(15000000); // 15 seconds
},
error: function(err)
{
print(err);
//ESP32.deepSleep(30000000); // 30 seconds
},
});
//Timer.del(readSensors);
//Timer.del(readSensors);
}
//ESP32.deepSleep(3600000000); //3600 seconds / 60 minutes
/*
Cfg.set({higrow:{temperature:jsonData.Temperature}});
Cfg.set({higrow:{moisture:jsonData.Water}});
Cfg.set({higrow:{humidity:jsonData.Humidity}});
Cfg.set({higrow:{light:jsonData.Light}});
*/
}, null);
// RPC Handlers
RPC.addHandler('HG.Temp.Read', function(args){
return { value: dht.getTemp() };
});
RPC.addHandler('HG.Humidity.Read', function(args){
return { value: dht.getHumidity() };
});
RPC.addHandler('HG.Light.Read', function(args){
return { value: ADC.read(lightPin) };
});
RPC.addHandler('HG.Moisture.Read', function(args){
return { value: ADC.read(moisturePin) };
});
RPC.addHandler('HG.StatusLED.On', function(args){
GPIO.write(statusLightPin, 0);
print("LED On");
if (GPIO.read(statusLightPin) !== 0)
{
return false;
}
return true;
});
RPC.addHandler('HG.StatusLED.Off', function(args){
GPIO.write(statusLightPin, 1);
if (GPIO.read(statusLightPin) !== 1)
{
return false;
}
return true;
});
// Monitor network connectivity.
Event.addGroupHandler(Net.EVENT_GRP, function(ev, evdata, arg) {
let status = true && connected;

Binary file not shown.

View File

@ -1,4 +1,4 @@
/* Auto-generated, do not edit. */
const char *build_id = "20180218-011554/???";
const char *build_timestamp = "2018-02-18T01:15:54Z";
const char *build_id = "20180218-182818/???";
const char *build_timestamp = "2018-02-18T18:28:18Z";
const char *build_version = "1.0";

View File

@ -1,5 +1,5 @@
{
"build_id": "20180218-011554/???",
"build_timestamp": "2018-02-18T01:15:54Z",
"build_id": "20180218-182818/???",
"build_timestamp": "2018-02-18T18:28:18Z",
"build_version": "1.0"
}

View File

@ -2,5 +2,5 @@
"arch": "esp32",
"platform": "esp32",
"app_name": "LilyGo-HiGrow-ESP32-Mongoose-OS-Firmware",
"build_time_ms": 31259
"build_time_ms": 26383
}

View File

@ -107,9 +107,8 @@
"deviceId": "",
"temperature": 0.0,
"humidity": 0.0,
"light": 0,
"statuslight": 0,
"moisture": 0,
"connected": false,
"battery_calibration": 2360
"connected": false
}
}

View File

@ -1,4 +1,4 @@
/* Auto-generated, do not edit. */
const char *mg_build_id = "20180218-011551/???";
const char *mg_build_timestamp = "2018-02-18T01:15:51Z";
const char *mg_build_version = "2018021801";
const char *mg_build_id = "20180218-182818/???";
const char *mg_build_timestamp = "2018-02-18T18:28:18Z";
const char *mg_build_version = "2018021818";

View File

@ -3,8 +3,8 @@
#include <stddef.h>
#include "mgos_config.h"
const struct mgos_conf_entry mgos_config_schema_[100] = {
{.type = CONF_TYPE_OBJECT, .key = "", .num_desc = 99},
const struct mgos_conf_entry mgos_config_schema_[99] = {
{.type = CONF_TYPE_OBJECT, .key = "", .num_desc = 98},
{.type = CONF_TYPE_OBJECT, .key = "device", .num_desc = 2},
{.type = CONF_TYPE_STRING, .key = "id", .offset = offsetof(struct mgos_config, device.id)},
{.type = CONF_TYPE_STRING, .key = "password", .offset = offsetof(struct mgos_config, device.password)},
@ -96,14 +96,13 @@ const struct mgos_conf_entry mgos_config_schema_[100] = {
{.type = CONF_TYPE_INT, .key = "disable_after", .offset = offsetof(struct mgos_config, wifi.ap.disable_after)},
{.type = CONF_TYPE_STRING, .key = "hostname", .offset = offsetof(struct mgos_config, wifi.ap.hostname)},
{.type = CONF_TYPE_BOOL, .key = "keep_enabled", .offset = offsetof(struct mgos_config, wifi.ap.keep_enabled)},
{.type = CONF_TYPE_OBJECT, .key = "higrow", .num_desc = 7},
{.type = CONF_TYPE_OBJECT, .key = "higrow", .num_desc = 6},
{.type = CONF_TYPE_STRING, .key = "deviceId", .offset = offsetof(struct mgos_config, higrow.deviceId)},
{.type = CONF_TYPE_DOUBLE, .key = "temperature", .offset = offsetof(struct mgos_config, higrow.temperature)},
{.type = CONF_TYPE_DOUBLE, .key = "humidity", .offset = offsetof(struct mgos_config, higrow.humidity)},
{.type = CONF_TYPE_INT, .key = "light", .offset = offsetof(struct mgos_config, higrow.light)},
{.type = CONF_TYPE_INT, .key = "statuslight", .offset = offsetof(struct mgos_config, higrow.statuslight)},
{.type = CONF_TYPE_INT, .key = "moisture", .offset = offsetof(struct mgos_config, higrow.moisture)},
{.type = CONF_TYPE_BOOL, .key = "connected", .offset = offsetof(struct mgos_config, higrow.connected)},
{.type = CONF_TYPE_INT, .key = "battery_calibration", .offset = offsetof(struct mgos_config, higrow.battery_calibration)},
};
const struct mgos_conf_entry *mgos_config_schema() {
@ -399,8 +398,8 @@ double mgos_config_get_higrow_temperature(struct mgos_config *cfg) {
double mgos_config_get_higrow_humidity(struct mgos_config *cfg) {
return cfg->higrow.humidity;
}
int mgos_config_get_higrow_light(struct mgos_config *cfg) {
return cfg->higrow.light;
int mgos_config_get_higrow_statuslight(struct mgos_config *cfg) {
return cfg->higrow.statuslight;
}
int mgos_config_get_higrow_moisture(struct mgos_config *cfg) {
return cfg->higrow.moisture;
@ -408,9 +407,6 @@ int mgos_config_get_higrow_moisture(struct mgos_config *cfg) {
int mgos_config_get_higrow_connected(struct mgos_config *cfg) {
return cfg->higrow.connected;
}
int mgos_config_get_higrow_battery_calibration(struct mgos_config *cfg) {
return cfg->higrow.battery_calibration;
}
/* }}} */
/* Setters {{{ */
@ -657,8 +653,8 @@ void mgos_config_set_higrow_temperature(struct mgos_config *cfg, double val
void mgos_config_set_higrow_humidity(struct mgos_config *cfg, double val) {
cfg->higrow.humidity = val;
}
void mgos_config_set_higrow_light(struct mgos_config *cfg, int val) {
cfg->higrow.light = val;
void mgos_config_set_higrow_statuslight(struct mgos_config *cfg, int val) {
cfg->higrow.statuslight = val;
}
void mgos_config_set_higrow_moisture(struct mgos_config *cfg, int val) {
cfg->higrow.moisture = val;
@ -666,7 +662,4 @@ void mgos_config_set_higrow_moisture(struct mgos_config *cfg, int val) {
void mgos_config_set_higrow_connected(struct mgos_config *cfg, int val) {
cfg->higrow.connected = val;
}
void mgos_config_set_higrow_battery_calibration(struct mgos_config *cfg, int val) {
cfg->higrow.battery_calibration = val;
}
/* }}} */

View File

@ -138,10 +138,9 @@ struct mgos_config_higrow {
char *deviceId;
double temperature;
double humidity;
int light;
int statuslight;
int moisture;
int connected;
int battery_calibration;
};
struct mgos_config {
@ -252,10 +251,9 @@ const struct mgos_config_higrow *mgos_config_get_higrow(struct mgos_config *cfg)
const char *mgos_config_get_higrow_deviceId(struct mgos_config *cfg);
double mgos_config_get_higrow_temperature(struct mgos_config *cfg);
double mgos_config_get_higrow_humidity(struct mgos_config *cfg);
int mgos_config_get_higrow_light(struct mgos_config *cfg);
int mgos_config_get_higrow_statuslight(struct mgos_config *cfg);
int mgos_config_get_higrow_moisture(struct mgos_config *cfg);
int mgos_config_get_higrow_connected(struct mgos_config *cfg);
int mgos_config_get_higrow_battery_calibration(struct mgos_config *cfg);
void mgos_config_set_device_id(struct mgos_config *cfg, const char *val);
void mgos_config_set_device_password(struct mgos_config *cfg, const char *val);
@ -338,10 +336,9 @@ void mgos_config_set_wifi_ap_keep_enabled(struct mgos_config *cfg, int v
void mgos_config_set_higrow_deviceId(struct mgos_config *cfg, const char *val);
void mgos_config_set_higrow_temperature(struct mgos_config *cfg, double val);
void mgos_config_set_higrow_humidity(struct mgos_config *cfg, double val);
void mgos_config_set_higrow_light(struct mgos_config *cfg, int val);
void mgos_config_set_higrow_statuslight(struct mgos_config *cfg, int val);
void mgos_config_set_higrow_moisture(struct mgos_config *cfg, int val);
void mgos_config_set_higrow_connected(struct mgos_config *cfg, int val);
void mgos_config_set_higrow_battery_calibration(struct mgos_config *cfg, int val);
/* }}} */
extern struct mgos_config mgos_sys_config;
@ -441,10 +438,9 @@ static inline const struct mgos_config_higrow *mgos_sys_config_get_higrow(void)
static inline const char *mgos_sys_config_get_higrow_deviceId(void) { return mgos_config_get_higrow_deviceId(&mgos_sys_config); }
static inline double mgos_sys_config_get_higrow_temperature(void) { return mgos_config_get_higrow_temperature(&mgos_sys_config); }
static inline double mgos_sys_config_get_higrow_humidity(void) { return mgos_config_get_higrow_humidity(&mgos_sys_config); }
static inline int mgos_sys_config_get_higrow_light(void) { return mgos_config_get_higrow_light(&mgos_sys_config); }
static inline int mgos_sys_config_get_higrow_statuslight(void) { return mgos_config_get_higrow_statuslight(&mgos_sys_config); }
static inline int mgos_sys_config_get_higrow_moisture(void) { return mgos_config_get_higrow_moisture(&mgos_sys_config); }
static inline int mgos_sys_config_get_higrow_connected(void) { return mgos_config_get_higrow_connected(&mgos_sys_config); }
static inline int mgos_sys_config_get_higrow_battery_calibration(void) { return mgos_config_get_higrow_battery_calibration(&mgos_sys_config); }
static inline void mgos_sys_config_set_device_id(const char *val) { mgos_config_set_device_id(&mgos_sys_config, val); }
static inline void mgos_sys_config_set_device_password(const char *val) { mgos_config_set_device_password(&mgos_sys_config, val); }
@ -527,10 +523,9 @@ static inline void mgos_sys_config_set_wifi_ap_keep_enabled(int val) { m
static inline void mgos_sys_config_set_higrow_deviceId(const char *val) { mgos_config_set_higrow_deviceId(&mgos_sys_config, val); }
static inline void mgos_sys_config_set_higrow_temperature(double val) { mgos_config_set_higrow_temperature(&mgos_sys_config, val); }
static inline void mgos_sys_config_set_higrow_humidity(double val) { mgos_config_set_higrow_humidity(&mgos_sys_config, val); }
static inline void mgos_sys_config_set_higrow_light(int val) { mgos_config_set_higrow_light(&mgos_sys_config, val); }
static inline void mgos_sys_config_set_higrow_statuslight(int val) { mgos_config_set_higrow_statuslight(&mgos_sys_config, val); }
static inline void mgos_sys_config_set_higrow_moisture(int val) { mgos_config_set_higrow_moisture(&mgos_sys_config, val); }
static inline void mgos_sys_config_set_higrow_connected(int val) { mgos_config_set_higrow_connected(&mgos_sys_config, val); }
static inline void mgos_sys_config_set_higrow_battery_calibration(int val) { mgos_config_set_higrow_battery_calibration(&mgos_sys_config, val); }
const struct mgos_conf_entry *mgos_config_schema();

Binary file not shown.

View File

@ -107,9 +107,8 @@
"deviceId": "",
"temperature": 0.0,
"humidity": 0.0,
"light": 0,
"statuslight": 0,
"moisture": 0,
"connected": false,
"battery_calibration": 2360
"connected": false
}
}

View File

@ -90,12 +90,11 @@
["wifi.ap.disable_after", "i", {"title": "If > 0, will disable itself after the specified number of seconds"}],
["wifi.ap.hostname", "s", {"title": "If not empty, DNS server will resolve given host name to the IP address of AP"}],
["wifi.ap.keep_enabled", "b", {"title": "Keep AP enabled when station is on"}],
["higrow", "o", {"title": "LilyGo HiGrow ESP32 Plant Sensor App Settings"}],
["higrow", "o", {"title": "LilyGo HiGrow ESP32 Plant Sensor v1 App Settings"}],
["higrow.deviceId", "s", {"title": "DeviceId"}],
["higrow.temperature", "d", {"title": "Temperature"}],
["higrow.humidity", "d", {"title": "Humidity"}],
["higrow.light", "i", {"title": "Light"}],
["higrow.statuslight", "i", {"title": "Light"}],
["higrow.moisture", "i", {"title": "Moisture"}],
["higrow.connected", "b", {"title": "Connected"}],
["higrow.battery_calibration", "i", {"title": "Battery ADC value at 4000mV"}]
["higrow.connected", "b", {"title": "Connected"}]
]

View File

@ -247,7 +247,7 @@
- title: Keep AP enabled when station is on
- - higrow
- o
- title: LilyGo HiGrow ESP32 Plant Sensor App Settings
- title: LilyGo HiGrow ESP32 Plant Sensor v1 App Settings
- - higrow.deviceId
- s
- ""
@ -260,7 +260,7 @@
- d
- 0
- title: Humidity
- - higrow.light
- - higrow.statuslight
- i
- 0
- title: Light
@ -272,10 +272,6 @@
- b
- false
- title: Connected
- - higrow.battery_calibration
- i
- 2360
- title: Battery ADC value at 4000mV
- - wifi.sta.enable
- false
- - wifi.sta.ssid

View File

@ -5,7 +5,7 @@ platform: esp32
platforms:
- esp32
author: Jason Harrell <info@latitude17.io>
description: LilyGo HiGrow ESP32 Plant Sensor
description: LilyGo HiGrow ESP32 Plant Sensor v1
sources:
- /fwbuild-volumes/latest/apps/LilyGo-HiGrow-ESP32-Mongoose-OS-Firmware/esp32/build_contexts/build_ctx_913791226/build/gen/deps_init.c
- /fwbuild-volumes/latest/apps/LilyGo-HiGrow-ESP32-Mongoose-OS-Firmware/esp32/build_contexts/build_ctx_913791226/libs/adc/esp32/src/esp32_adc.c
@ -324,7 +324,7 @@ config_schema:
- title: Keep AP enabled when station is on
- - higrow
- o
- title: LilyGo HiGrow ESP32 Plant Sensor App Settings
- title: LilyGo HiGrow ESP32 Plant Sensor v1 App Settings
- - higrow.deviceId
- s
- ""
@ -337,7 +337,7 @@ config_schema:
- d
- 0
- title: Humidity
- - higrow.light
- - higrow.statuslight
- i
- 0
- title: Light
@ -349,10 +349,6 @@ config_schema:
- b
- false
- title: Connected
- - higrow.battery_calibration
- i
- 2360
- title: Battery ADC value at 4000mV
- - wifi.sta.enable
- false
- - wifi.sta.ssid

Binary file not shown.

View File

@ -10,32 +10,32 @@ load('api_dht.js');
load('api_adc.js');
load('api_rpc.js');
//Pins
// Pins
let resetPin = 0;
let ledPin = 16;
let statusLightPin = 16;
let dhtPin = 22;
let moisturePin = 32;
let statusLightPin = 34;
let lightPin = 34;
// Turn on status led
GPIO.set_mode(ledPin, GPIO.MODE_OUTPUT);
GPIO.write(ledPin, 0);
GPIO.set_mode(statusLightPin, GPIO.MODE_OUTPUT);
GPIO.write(statusLightPin, 0);
//Reset Handler
// Reset Handler
GPIO.set_mode(resetPin, GPIO.MODE_INPUT);
GPIO.set_int_handler(resetPin, GPIO.INT_EDGE_NEG, function(resetPin) {
print('Pin', resetPin, 'got interrupt');
GPIO.toggle(ledPin);
GPIO.toggle(statusLightPin);
Sys.usleep(200000);
GPIO.toggle(ledPin);
GPIO.toggle(statusLightPin);
Sys.usleep(200000);
GPIO.toggle(ledPin);
GPIO.toggle(statusLightPin);
Sys.usleep(200000);
GPIO.toggle(ledPin);
GPIO.toggle(statusLightPin);
Sys.usleep(200000);
GPIO.toggle(ledPin);
GPIO.toggle(statusLightPin);
Sys.usleep(200000);
GPIO.write(ledPin, 0);
GPIO.write(statusLightPin, 0);
Cfg.set({bt:{enable:true}});
Cfg.set({wifi:{sta:{enable:false}}});
@ -55,21 +55,21 @@ let readSensors = Timer.set(5000, Timer.REPEAT, function() {
let t = dht.getTemp();
let h = dht.getHumidity();
let m = ADC.read(moisturePin);
let l = ADC.read(statusLightPin);
let l = ADC.read(lightPin);
print("DeviceId:",deviceId,"Temperature:",t,"Humidity:",h,"Moisture:",m,"StatusLight:",l);
print("DeviceId:",deviceId,"Temperature:",t,"Humidity:",h,"Moisture:",m,"Light:",l);
if (deviceId !== "" && connected)
{
GPIO.write(ledPin, 1);
let jsonData = {DeviceId: deviceId, Temperature: t, Humidity: h, Moisture: m, StatusLight: l};
GPIO.write(statusLightPin, 1);
let jsonData = {'DeviceId': deviceId, 'Temperature': t, 'Humidity': h, 'Moisture': m, 'Light': l};
HTTP.query({
headers: {'Content-Type' : 'application/json'},
url: 'http://httpbin.org/post', // replace with your own endpoint
data: jsonData,
success: function(body, full_http_msg)
{
print(body);
//print(body);
// sleep for 15 seconds, then (re)boot up and do it all over again
//ESP32.deepSleep(15000000); // 15 seconds
},
@ -93,15 +93,15 @@ RPC.addHandler('HG.Humidity.Read', function(args){
return { value: dht.getHumidity() };
});
RPC.addHandler('HG.Light.Read', function(args){
return { value: ADC.read(statusLightPin) };
return { value: ADC.read(lightPin) };
});
RPC.addHandler('HG.Moisture.Read', function(args){
return { value: ADC.read(moisturePin) };
});
RPC.addHandler('HG.StatusLED.On', function(args){
GPIO.write(ledPin, 0);
GPIO.write(statusLightPin, 0);
print("LED On");
if (GPIO.read(ledPin) !== 0)
if (GPIO.read(statusLightPin) !== 0)
{
return false;
}
@ -109,8 +109,8 @@ RPC.addHandler('HG.StatusLED.On', function(args){
return true;
});
RPC.addHandler('HG.StatusLED.Off', function(args){
GPIO.write(ledPin, 1);
if (GPIO.read(ledPin) !== 1)
GPIO.write(statusLightPin, 1);
if (GPIO.read(statusLightPin) !== 1)
{
return false;
}