Skip to content

Commit

Permalink
Scripts: memanalyser fixes (xoseperez#2014)
Browse files Browse the repository at this point in the history
* scripts: memanalyzer fixes

- cleanup duplication
- cleanup external dependencies
- properly use subprocess when calling pio, add debug mode
- cleanup argparse usage, use store_true actions instead of counters
- use python3 syntax and python3 shebang by default
- fix some issues with module dependencies

* move to scripts

* use simple return

* quick fix for rfm

* codacy unused import

* formatting

* show defaults

* while at it, rewrite to make pylint happy

* fix unused

* add windows support + note
  • Loading branch information
mcspr authored Nov 26, 2019
1 parent 960b32c commit 0b5d200
Show file tree
Hide file tree
Showing 6 changed files with 427 additions and 310 deletions.
1 change: 0 additions & 1 deletion code/espurna/config/arduino.h
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,6 @@
//#define RFM69_SUPPORT 1
//#define RPN_RULES_SUPPORT 0
//#define SCHEDULER_SUPPORT 0
//#define SENSOR_SUPPORT 1
//#define SPIFFS_SUPPORT 1
//#define SSDP_SUPPORT 1
//#define TELNET_SUPPORT 0
Expand Down
5 changes: 5 additions & 0 deletions code/espurna/config/dependencies.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,13 @@
#if RPN_RULES_SUPPORT
#undef BROKER_SUPPORT
#define BROKER_SUPPORT 1 // If RPN Rules enabled enable BROKER
#undef WEB_SUPPORT
#define WEB_SUPPORT 1
#undef MQTT_SUPPORT
#define MQTT_SUPPORT 1
#endif


#if INFLUXDB_SUPPORT
#undef BROKER_SUPPORT
#define BROKER_SUPPORT 1 // If InfluxDB enabled enable BROKER
Expand Down
8 changes: 6 additions & 2 deletions code/espurna/i2c.ino
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,9 @@ void i2cScan() {
if (nDevices == 0) DEBUG_MSG_P(PSTR("[I2C] No devices found\n"));
}

void i2cCommands() {
#if TERMINAL_SUPPORT

void _i2cInitCommands() {

terminalRegisterCommand(F("I2C.SCAN"), [](Embedis* e) {
i2cScan();
Expand All @@ -365,6 +367,8 @@ void i2cCommands() {

}

#endif // TERMINAL_SUPPORT

void i2cSetup() {

unsigned char sda = getSetting("i2cSDA", I2C_SDA_PIN).toInt();
Expand All @@ -381,7 +385,7 @@ void i2cSetup() {
DEBUG_MSG_P(PSTR("[I2C] Using GPIO%u for SDA and GPIO%u for SCL\n"), sda, scl);

#if TERMINAL_SUPPORT
i2cCommands();
_i2cInitCommands();
#endif

#if I2C_CLEAR_BUS
Expand Down
6 changes: 2 additions & 4 deletions code/espurna/sensor.ino
Original file line number Diff line number Diff line change
Expand Up @@ -1543,11 +1543,9 @@ void _sensorReport(unsigned char index, double value) {
char buffer[64];
dtostrf(value, 1, decimals, buffer);

#if BROKER_SUPPORT
#if not BROKER_REAL_TIME
#if BROKER_SUPPORT && (not BROKER_REAL_TIME)
SensorBroker::Publish(magnitudeTopic(magnitude.type), magnitude.global, value, buffer);
#endif
#endif

#if MQTT_SUPPORT

Expand Down Expand Up @@ -1803,7 +1801,7 @@ void sensorLoop() {
// -------------------------------------------------------------

value_show = _magnitudeProcess(magnitude.type, magnitude.decimals, value_raw);
#if BROKER_REAL_TIME
#if BROKER_SUPPORT && BROKER_REAL_TIME
{
char buffer[64];
dtostrf(value_show, 1-sizeof(buffer), magnitude.decimals, buffer);
Expand Down
303 changes: 0 additions & 303 deletions code/memanalyzer.py

This file was deleted.

Loading

0 comments on commit 0b5d200

Please sign in to comment.