Giter Site home page Giter Site logo

mdash's Introduction

Arduino / ESP-IDF client library for mdash.net

See Documentation for the quick start guide.

In order to simulate an mDash device on your Mac/Linux workstation, register a device on mDash and run the following command from the root of this repo:

$ make -C posix ARGS="-pass DEVICE_MDASH_PASSWORD"

mdash's People

Contributors

cpq avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mdash's Issues

Can't compile Minimal from platformio

Hello!

I'm trying to load the library from platformio, but I get the following error:

Linking .pio/build/esp32doit-devkit-v1/firmware.elf
.pio/build/esp32doit-devkit-v1/src/main.ino.cpp.o:(.literal._Z5setupv+0x2c): undefined reference to `mDashInit'
.pio/build/esp32doit-devkit-v1/src/main.ino.cpp.o: In function `setup()':
/home/fermuch/Documentos/Dev/Work/AYVU/test-esp32/src/main.ino:26: undefined reference to `mDashInit'
collect2: error: ld returned 1 exit status
*** [.pio/build/esp32doit-devkit-v1/firmware.elf] Error 1

The sketch is the following:

#define MDASH_APP_NAME "MinimalApp"
#include <mDash.h>

#include <WiFi.h>

#define WIFI_NETWORK "MyWifiNetworkName"
#define WIFI_PASSWORD "MyWifiPassword"
#define DEVICE_PASSWORD "mDashDeviceToken"

void setup() {
  Serial.begin(115200);
  WiFi.begin(WIFI_NETWORK, WIFI_PASSWORD);
  mDashBegin(DEVICE_PASSWORD);
}

void loop() {
  delay(100);
}

And finally this is the platformio.ini file:

[env:esp32doit-devkit-v1]
platform = espressif32
board = esp32doit-devkit-v1
framework = arduino
lib_deps =
  https://github.com/cesanta/mDash.git

(It also doesn't work if I use a release instead of pulling from git)

Local device clock drift + offset induced by mDash

Release 1.2.14 introduced an "hourly automatic NTP sync". Unfortunately this change also introduced a time offset in the local device clock. In our testing this offset is about 30-32 minutes vs. UTC. This was seen across our entire fleet. Manual NTP syncs were quickly overridden by the mDash automatic & erroneous syncs.

Reverting to 1.2.13 resolves the issue. Strongly recommend rolling back the changes introduced in 1.2.14

Core 1 arduino task hangs after calling any mDash function

While running mDash 1.2.16 on Platformio ESP32 core 6.3.1 (latest), mDash works perfectly until you call mDashShadowUpdate or mDashNotify (with valid args). If you do that, the Arduino main task on core 1 will hang completely. Interestingly, no error is thrown.

I'm also using a LAN8720 PHY using the built-in Arduino Library (ETH), according to the example here: https://github.com/espressif/arduino-esp32/blob/master/libraries/Ethernet/examples/ETH_LAN8720/ETH_LAN8720.ino

What is more interesting is that firmware updates, FS, RPC and even the spontaneous shadow update that happen when the device becomes online are all working normally. The issue only presents itself when the functions noted above are called.

Even if the Arduino task hangs, mDash continues to run normally (you can control the device from the dashboard).

can not compile mdash library

when i am trying to compile example code of mdash, arduino ide throws error as shown below.

c:/users/ashish/downloads/arduino-1.8.9-windows/arduino-1.8.9/portable/packages/esp8266/tools/xtensa-lx106-elf-gcc/2.5.0-3-20ed2b9/bin/../lib/gcc/xtensa-lx106-elf/4.8.2/../../../../xtensa-lx106-elf/bin/ld.exe: C:\Users\ashish\AppData\Local\Temp\arduino_build_145131/Shadow.ino.elf section .text1' will not fit in region iram1_0_seg'

c:/users/ashish/downloads/arduino-1.8.9-windows/arduino-1.8.9/portable/packages/esp8266/tools/xtensa-lx106-elf-gcc/2.5.0-3-20ed2b9/bin/../lib/gcc/xtensa-lx106-elf/4.8.2/../../../../xtensa-lx106-elf/bin/ld.exe: C:\Users\ashish\Documents\Arduino\libraries\mDash\src\esp8266\libmDash.a: in function `mDashCLI':

/Users/lsm/src/cesanta.com/alib/cli.c:66: undefined reference to `recvfrom'

c:/users/ashish/downloads/arduino-1.8.9-windows/arduino-1.8.9/portable/packages/esp8266/tools/xtensa-lx106-elf-gcc/2.5.0-3-20ed2b9/bin/../lib/gcc/xtensa-lx106-elf/4.8.2/../../../../xtensa-lx106-elf/bin/ld.exe: /Users/lsm/src/cesanta.com/alib/cli.c:66: undefined reference to `sendto'

c:/users/ashish/downloads/arduino-1.8.9-windows/arduino-1.8.9/portable/packages/esp8266/tools/xtensa-lx106-elf-gcc/2.5.0-3-20ed2b9/bin/../lib/gcc/xtensa-lx106-elf/4.8.2/../../../../xtensa-lx106-elf/bin/ld.exe: C:\Users\ashish\Documents\Arduino\libraries\mDash\src\esp8266\libmDash.a: in function `serve_dns':

/Users/lsm/src/cesanta.com/alib/cli.c:75: undefined reference to `recvfrom'

c:/users/ashish/downloads/arduino-1.8.9-windows/arduino-1.8.9/portable/packages/esp8266/tools/xtensa-lx106-elf-gcc/2.5.0-3-20ed2b9/bin/../lib/gcc/xtensa-lx106-elf/4.8.2/../../../../xtensa-lx106-elf/bin/ld.exe: C:\Users\ashish\Documents\Arduino\libraries\mDash\src\esp8266\libmDash.a: in function `serve_dns':

/Users/lsm/src/cesanta.com/alib/dns.c:41: undefined reference to `sendto'

collect2.exe: error: ld returned 1 exit status

Using library mDash at version 1.0.45 in folder: C:\Users\ashish\Documents\Arduino\libraries\mDash
exit status 1
Error compiling for board NodeMCU 1.0 (ESP-12E Module).

Restore CLI access

We are currently running mDash v1.2.13 and esp-idf v3.3.6 in production. We use the CLI function to provision manufacturing data for each physical device at the factory for new hardware builds. This has been working well for several years now and many production runs.

We'd like to move to mDash v1.2.16 and esp-idf v4.x, but the CLI functionality has been removed in 1.2.16. That is a show-stopper for us as it breaks our manufacturing flow. Can this be restored? If not, can the CLI source be shared so we can restore it ourselves in our fork?

event.c:18:mg_error 0x36 DNS timeout

try little MinimalApp.ino

#define MDASH_APP_NAME "MinimalApp"
#include <mDash.h>

#include <WiFi.h>

#define WIFI_NETWORK "ls"
#define WIFI_PASSWORD "oke1234612"
#define DEVICE_PASSWORD "jaCDxQea7t90BOSqGNR5Xfw"

void setup() {
  Serial.begin(115200);
  WiFi.begin(WIFI_NETWORK, WIFI_PASSWORD);
  mDashBegin(DEVICE_PASSWORD);
}

void loop() {
  delay(100);
}

here for ➜ mos console

Using port /dev/ttyUSB0
[Jun  7 12:27:29.030] ets Jun  8 2016 00:22:57
[Jun  7 12:27:29.043] 
[Jun  7 12:27:29.043] rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
[Jun  7 12:27:29.043] configsip: 0, SPIWP:0xee
[Jun  7 12:27:29.043] clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
[Jun  7 12:27:29.047] mode:DIO, clock div:1
[Jun  7 12:27:29.049] load:0x3fff0018,len:4
[Jun  7 12:27:29.051] load:0x3fff001c,len:1216
[Jun  7 12:27:29.053] ho 0 tail 12 room 4
[Jun  7 12:27:29.055] load:0x40078000,len:9720
[Jun  7 12:27:29.057] ho 0 tail 12 room 4
[Jun  7 12:27:29.059] load:0x40080400,len:6352
[Jun  7 12:27:29.061] entry 0x400806b8
[Jun  7 12:27:29.570] 1970-01-01 00:00:00  I log.c:18:mg_log_set       Setting log level to 1
[Jun  7 12:27:29.577] 1970-01-01 00:00:00  E sock.c:117:ll_write       0x37 tUc -1/27 118
[Jun  7 12:27:29.583] 1970-01-01 00:00:00  E sock.c:117:ll_write       0x37 tUc -1/33 118
[Jun  7 12:27:32.581] 1970-01-01 00:00:03  E event.c:18:mg_error       0x36 DNS timeout
[Jun  7 12:27:34.588] 1970-01-01 00:00:05  E event.c:18:mg_error       0x39 DNS timeout

how can i reach dnsresolv ?

Reboot Loop on Incorrect Password

When the device password is incorrect, a Reboot RPC command is received that results in a reboot loop.
This occurs in the Minimal.ino example.

5759 2 mDash.c:656:dev_cb                    {"id":1,"result":{"fw_version":"1.2.16-a-10812-Adafruit ESP32 Feather","arch":"esp32","fw_id":"20240126-134300","app":"FIRMWARE","uptime":1706305428,"ram_free":84320,"reboot_reason":"power-on","id":"...","public_key":"..."}}
588b 2 mDash.c:646:dev_cb               RPC: {"id":40,"method":"Sys.Reboot"}

Is this expected behaviour?
Is there a means to verify authorization without receiving the Reboot RPC?

The application for this is a device password that is entered manually in the field.

Thanks,

Are source files available to build libmdash.a?

I am trying to use the mDash library in Linux. src/linux-x64/libmdash.a seems to be a 32-bit elf library and not 64-bit. Also, this library cannot be loaded by ld. I get the following error:
/usr/bin/ld: ../src/linux-x64/libmDash.a: unrecognized relocation (0x2b) in section .text
So it would be great to have access to the source to build libmdash.a from scratch.

Stopping the loop() task execution when using mDashShadowUpdate()

Dear @cpq @novlean,
Thanks for your great efforts.

My code was running perfectly with Mdash V1.2.14 & the esp-Arduino V1.0.6.

Recently, I have upgraded the esp-Arduino version from V1.0.6 to V2.0.9 & the mDash version from V1.2.14 to V1.2.16.
Now, when I am using mDashShadowUpdate("{%Q:{%Q:{%Q:%Q}}}","state", "reported", "Key", "Success"); . It is stopping the loop() task & the Mdash goes offline & comes back. The Mdash is working such as FS & RPC, But the execution of loop() task is stopped.

Some Insights:
I have checked the mDashNotify() function, saw MDashMutexLock() initialization. I have a doubt that may be the Mutex is stopping the loop() function or some other freeRTOS related problems.

Build Logs:

Processing esp32dev (platform: [email protected]; board: esp32dev; framework: arduino)
-------------------------------------------------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/espressif32/esp32dev.html
PLATFORM: Espressif 32 (6.3.1) > Espressif ESP32 Dev Module
HARDWARE: ESP32 240MHz, 320KB RAM, 16MB Flash
DEBUG: Current (esp-prog) External (cmsis-dap, esp-bridge, esp-prog, iot-bus-jtag, jlink, minimodule, olimex-arm-usb-ocd, olimex-arm-usb-ocd-h, olimex-arm-usb-tiny-h, olimex-jtag-tiny, tumpa)
PACKAGES:
 - framework-arduinoespressif32 @ 3.20009.0 (2.0.9)
 - tool-esptoolpy @ 1.40501.0 (4.5.1)
 - toolchain-xtensa-esp32 @ 8.4.0+2021r2-patch5
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 59 compatible libraries
Scanning dependencies...
Dependency Graph
|-- mDash @ 1.2.16+sha.8bd6647
|-- eModbus @ 1.3.0    

Platform.ini file:

[platformio]
default_envs = 

[env:esp32dev]
platform = [email protected]
board = esp32dev
framework = arduino
board_upload.flash_size = 16MB
board_upload.maximum_size = 16777216
board_build.partitions = F:\Aspiration Energy\Heat Pump Monitoring\Hardware Development\Thermelgy tMY Future\Firmware\Development\Thermelgy Gen2 Gateway\Partition\Thermelgy_Custom_16MB.csv 
monitor_speed = 115200
monitor_filters = esp32_exception_decoder
build_flags =
	-Isdkconfig
	-DLOG_LEVEL=LOG_LEVEL_ERROR
	-DCORE_DEBUG_LEVEL=3
	-DARDUINOJSON_USE_DOUBLE=0
lib_deps = 
	https://github.com/cesanta/mDash.git#1.2.16
	[email protected]

Kindly help me to solve the issue.

ESP8266 Fails to compile under the Arduino IDE

LINUX_DIST="Linux Mint 18.3 Sylvia MATE 32-bit"
KERNEL=Linux computer 4.10.0-38-generic i686 i686 i686 GNU/Linux

ARDUINO IDE: 1.8.10 (32bit)
mDash Library: 1.1.8 (Installed using Arduino IDE library manager)
ESP8266 BOARD: 2.5.2 (Installed with board manager from Arduino IDE)

OUTPUT:


/home/name/.arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/2.5.0-3-20ed2b9/bin/../lib/gcc/xtensa-lx106-elf/4.8.2/../../../../xtensa-lx106-elf/bin/ld: /home/name/Arduino/libraries/mDash/src/esp8266/libmDash.a:(.irom0.text.mDash.c.212.89+0x54): undefined reference to `esp_random'
/home/name/.arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/2.5.0-3-20ed2b9/bin/../lib/gcc/xtensa-lx106-elf/4.8.2/../../../../xtensa-lx106-elf/bin/ld: /home/name/Arduino/libraries/mDash/src/esp8266/libmDash.a:(.irom0.text.mDash.c.212.89+0xa4): undefined reference to `esp_random'
collect2: error: ld returned 1 exit status
exit status 1

Compilation Error : undefined reference to `mDashInit'

Arduino IDE 1.8.12
mdash 1.2.5

sketch\Minimal.ino.cpp.o:(.literal._Z5setupv+0x2c): undefined reference to `mDashInit'
sketch\Minimal.ino.cpp.o: In function `setup()':
C:\Program Files (x86)\Arduino\libraries\mDash-1.2.5\examples\Minimal/Minimal.ino:26: undefined reference to `mDashInit'
collect2.exe: error: ld returned 1 exit status
exit status 1
Error compiling for board ESP32 Dev Module.

It appears that libmdash.a seems to be a 32-bit elf library and not 64-bit. Thus, this library cannot be loaded by the IDE. Thus to solve the issue, I tried to use Arduino IDE V 1.8.10, and it worked. Pleas solve the issue for the latest Arduino IDE and please give the source code for library and not a ".a" file.

Thank You

Compilation Error

Hi, I succesfully flashed ESP via Mongoose OS.
Now I am trying same thing via Arduino IDE 2.1.1. on Windows
I have installed mdash lib v1.2.16, I am trying to flash the "minimal example"
During the compilation, I am getting this error:

`d:\Projekty\Arduino\libraries\mDash\src\mDash.c: In function 'enable_wdt':
d:\Projekty\Arduino\libraries\mDash\src\mDash.c:85:3: error: implicit declaration of function 'esp_task_wdt_add'; did you mean 'esp_flash_read'? [-Werror=implicit-function-declaration]
esp_task_wdt_add(xTaskGetIdleTaskHandleForCPU(CPU_CORE));
^~~~~~~~~~~~~~~~
esp_flash_read
d:\Projekty\Arduino\libraries\mDash\src\mDash.c: In function 'disable_wdt':
d:\Projekty\Arduino\libraries\mDash\src\mDash.c:88:3: error: implicit declaration of function 'esp_task_wdt_delete'; did you mean 'esp_timer_delete'? [-Werror=implicit-function-declaration]
esp_task_wdt_delete(xTaskGetIdleTaskHandleForCPU(CPU_CORE));
^~~~~~~~~~~~~~~~~~~
esp_timer_delete
cc1.exe: some warnings being treated as errors

exit status 1

Compilation error: exit status 1`

Could you help me please?

version 1.2.15 setting the device clock to wildly incorrect values

The function sntpcb (apparently - source code is not available) misinterprets the return value of mg_sntp_parse,
This behaviour appears on both esp32 (see this mdash forum post) and linux-x64. Debugging on linux-x64 shows that sntpcb is discarding the upper 32-bit portion of the mg_sntp_parse return value (which is uint64_t count of milliseconds since the epoch) and using the lower 32 bits as the count of seconds since the epoch, leading to nonsensical system time.

Below are the ugly linux-x64 debug details, but the behaviour is identical on esp32.
The test app which I debugged:

#include <stdio.h>
#include <unistd.h>
#include <time.h>
#include "mDash.h"

int main (int argc, char *argv[]) {
#define DEVICE_PASSWORD "..."
  mDashBegin(DEVICE_PASSWORD);
  int i;
  for (i = 0;;++i) {
    usleep(1000000); // sleep 1 second
    time(&t);
    printf("Slept %d and time is now %ld\n", i, t);
  }
}

State of relevant x64 registers upon leaving mg_sntp_parse:

Thread 2 "test" hit Breakpoint 2, 0x0000555555571551 in mg_sntp_parse (buf=0x7ffff00015a0 "$\001", len=48) at x2.c:6316
6316	x2.c: No such file or directory.
(gdb) info registers 
rax            0x181f6c2237f       1657702327167
rbx            0x0                 0
rcx            0xa7                167
rdx            0xdc82              56450
rsi            0x181f6c222d8       1657702327000

The correct (except for cesanta/mongoose#1628) milliseconds since the epoch is in rax.
But just before the call to mg_log inside of sntpcb, here's what the registers hold:

Thread 2 "test" hit Breakpoint 1, 0x000055555557aac6 in sntpcb (c=0x7ffff0000b60, ev=17, evd=0x7ffff7d90d00, fnd=0x0) at x2.c:10986
10986	in x2.c
(gdb) info registers 
rax            0x0                 0
rbx            0x0                 0
rcx            0x0                 0
rdx            0x9d7f4000          2642362368
rsi            0xf6c2237f          4139918207

Notice that rsi holds the lower 32-bits (0xf6c2237f) of the return value from mg_sntp_parse (0x181f6c2237f), and the upper 32-bits has apparently disappeared.
Letting the code continue, we get this message:

SNTP: setting time to 4139918207.2642362368

which has clearly used the incorrect values from registers rsi and rdx.

This bug is a show-stopper. Although the initial connection to the mDash websocket server appears to set the device clock correctly, sntpcb will eventually clobber it.

Getting error while compiling after updating to platform-espressif32 V4.1.0

Dear @cpq @novlean & team,

Thank you for your great library. I actually updated the platform-espressif32 from V3.5.0 to V4.1.0. After updating it, I am getting error while building. It was compiling perfectly on 3.4 version. Kindly help me to solve it.
I also opened an issue on :
platformio/platform-espressif32#769 . They guide me to ask your support.

platformio/platform-espressif32#769 (comment)

Error Details :

`c:/users/asish johney george/.platformio/packages/toolchain-xtensa-esp32/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: .pio/libdeps/esp32dev/mDash/src/esp32\libmDash.a:(.literal+0x534): undefined reference to `lwip_recvfrom_r'
c:/users/asish johney george/.platformio/packages/toolchain-xtensa-esp32/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: .pio/libdeps/esp32dev/mDash/src/esp32\libmDash.a:(.literal+0x548): undefined reference to `lwip_sendto_r'
c:/users/asish johney george/.platformio/packages/toolchain-xtensa-esp32/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: .pio/libdeps/esp32dev/mDash/src/esp32\libmDash.a: in function `mlog':
/Users/lsm/src/cesanta.com/alib/log.c:28: undefined reference to `lwip_recvfrom_r'
c:/users/asish johney george/.platformio/packages/toolchain-xtensa-esp32/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: .pio/libdeps/esp32dev/mDash/src/esp32\libmDash.a: in function `ll_read':
/Users/lsm/src/cesanta.com/alib/src/sock.c:102: undefined reference to `lwip_sendto_r'
collect2.exe: error: ld returned 1 exit status
*** [.pio\build\esp32dev\firmware.elf] Error 1`

Platformio.ini File:
`


[platformio]
default_envs = 

[env:esp32dev]
platform = espressif32
;platform = https://github.com/platformio/platform-espressif32.git#v3.5.0
board = esp32dev
framework = arduino
platform_packages = 
 	framework-arduinoespressif32 @ https://github.com/espressif/arduino-esp32.git
;	framework-arduinoespressif32@~2.0.2
;	toolchain-xtensa32@~2.80400.0
;	framework-arduinoespressif32@~2.0.2

;	framework-arduinoespressif32@https://github.com/espressif/arduino-esp32.git#2.0.2
board_build.partitions = F:\Aspiration Energy\Heat Pump Monitoring\Hardware Development\Thermelgy tMY Future\Firmware\Development\Thermelgy Gen2 Gateway\Partition\Thermelgy_Custom_16MB.csv
lib_extra_dirs = C:\Users\Asish Johney George\Documents\Arduino\libraries
monitor_speed = 115200
build_flags = 
	-L.pio/libdeps/esp32dev/mDash/src/esp32/ -llibmDash
	-DLOG_LEVEL=LOG_LEVEL_NONE
lib_deps = 
	cesanta/mDash@^1.2.14
	eModbus@^1.3
	esphome/AsyncTCP-esphome@^1.2.2
	knolleary/PubSubClient@^2.8

[env:env1]
lib_deps = 
	eModbus@^1.3
	esphome/AsyncTCP-esphome@^1.2.2
	knolleary/PubSubClient@^2.8

`
Build Details:

Building...
CONFIGURATION: https://docs.platformio.org/page/boards/espressif32/esp32dev.html
PLATFORM: Espressif 32 (4.1.0) > Espressif ESP32 Dev Module
HARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash
DEBUG: Current (esp-prog) External (esp-prog, iot-bus-jtag, jlink, minimodule, olimex-arm-usb-ocd, olimex-arm-usb-ocd-h, olimex-arm-usb-tiny-h, olimex-jtag-tiny, tumpa)
PACKAGES:
 - framework-arduinoespressif32 @ 2.0.3+sha.b3c203d (git+https://github.com/espressif/arduino-esp32.git)
 - tool-esptoolpy @ 1.30100.210531 (3.1.0)
 - toolchain-xtensa-esp32 @ 8.4.0+2021r2-patch3
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 107 compatible libraries
Scanning dependencies...

Incomplete filenames in mDash for release 1.2.15

I have noticed that the files loaded onto the SPIFFS partition of the ESP32, do not show their full names in mDash, when using the latest release. Rolling back to release 1.2.14 solves this issue. Below is an example.

Here is what the Files list should show, using release 1.2.14:
mDash_1_2_14

Here is what the Files list shows, using release 1.1.15:
mDash_1_2_15

The first two characters are disappearing in the latest release. Due to this, none of the files can be loaded as they are not found on the ESP32, and it fails every time.

Is there are any limitation on the total filename size across all files? Has anyone else faced this issue?

100% Progress bar stuck

image

in mDash I see 100% progress bar for the firmware update of ESP32, which does not let the shadow states update ..

Arduino Lib fails to compile

Just pulled the latest release (1.0.43), using Arduino v 1.8.10 on MacOS.

Getting this error after a manual install of the lib (vs Library manages, makes no difference it seems)

~/Documents/Arduino/libraries/mDash/examples/Shadow/Shadow.ino: In function 'void setup()':
Shadow:42:42: error: 'mDashShadowDeltaSubscribe' was not declared in this scope
   mDashShadowDeltaSubscribe(onShadowDelta);
                                          ^
~/Documents/Arduino/libraries/mDash/examples/Shadow/Shadow.ino: In function 'void loop()':
Shadow:54:72: error: 'mDashPublish' was not declared in this scope
   mDashPublish(topic.c_str(), "{%Q:%lu}", "free_ram", mDashGetFreeRam());
                                                                        ^
exit status 1
'mDashShadowDeltaSubscribe' was not declared in this scope

Maybe I'm doing something goofy?

Failed to compile (collect issue) with latest ESP32 core (undefined reference to `mDashInit')

  1. Find Arduino's esp32 plaform.txt file and change it like in PR4209
  2. Find library.properties file in the installed mDash library, and remove line ldflags=-lmDash
  3. Restart Arduino IDE

Originally posted by @cpq in #8 (comment)

So these steps have been followed, adapting since plastform.txt has changed, IDE restarted, but the issue persists.

## Combine gc-sections, archives, and objects
## recipe.c.combine.pattern="{compiler.path}{compiler.c.elf.cmd}" "-Wl,--Map={build.path}/{build.project_name}.map" "-L{compiler.sdk.path}/lib" "-L{compiler.sdk.path}/ld" {compiler.c.elf.flags} {compiler.c.elf.extra_flags} {build.extra_flags} -Wl,--start-group {object_files} "{archive_file_path}" {compiler.c.elf.libs} -Wl,--end-group -Wl,-EL -o "{build.path}/{build.project_name}.elf"
recipe.c.combine.pattern="{compiler.path}{compiler.c.elf.cmd}" "-Wl,--Map={build.path}/{build.project_name}.map" "-L{compiler.sdk.path}/lib" "-L{compiler.sdk.path}/ld" {compiler.c.elf.flags} {compiler.c.elf.extra_flags} {build.extra_flags} {compiler.libraries.ldflags} -Wl,--start-group {object_files} "{archive_file_path}" {compiler.c.elf.libs} -Wl,--end-group -Wl,-EL -o "{build.path}/{build.project_name}.elf"
c:/users/xx/appdata/local/arduino15/packages/esp32/tools/riscv32-esp-elf-gcc/gcc8_4_0-esp-2021r1/bin/../lib/gcc/riscv32-esp-elf/8.4.0/../../../../riscv32-esp-elf/bin/ld.exe:
C:\Users\xx\AppData\Local\Temp\arduino_build_855237\sketch\Minimal.ino.cpp.o: in function `setup()':
C:\Users\xx\Documents\Arduino\libraries\mDash\examples\Minimal/Minimal.ino:26: undefined reference to `mDashInit'
collect2.exe: error: ld returned 1 exit status

The IDE is 1.8.19 and i tested with two version of the ESP32 core : 2.0 and the current master branch. In both cases it fails at the collect step.

ESP8266 compatibility with mDash

Hi,

I wished to have clarity on the compatibility of ESP8266 module with mDash. I am unable to find clear cut documentation/instructions about whether ESP8266 is supported by mDash or not.

Kindly share what all works for ESP8266 in mDash, and does arduino IDE work?

Release Source Code

No one can do bug fixes or updates to use with newer frameworks.
Have you something to hide?

esp-idf v4 not supported

Sorry I didn't keep the logs, so this won't be very specific.
When building the smart light example against a relatively recent pull of the ESP-IDF master branch,
I got link errors complaining about lwip_recvfrom_r. It turns out newer versions of ESP-IDF use a newer version of lwip in which the sockets api has been changed and this has been removed.
Building with ESP_IDF release/v3.3 worked fine.
It would be useful to document the supported ESP-IDF version in the quickstart guide. And/or check which idf version is being used and modify the calls to support the the newer version.
Thanks,

Implementation with SIM800

I have been trying to work with this library to make OTAs. However, in recent work, I have used an ESP32 with SIM800l to establish internet connection via 3G, but I am unable to compile the code on the microcontroller. Does anyone know if there is an example code to do this job? I would appreciate if you could help me.

Not able to connect Mdash on ESP32 with Ethernet W5500

Dear @cpq @novlean ,

Thankq so much for this library.
Hi, I have used the Mdash with WiFi & PPP in ESP32 Arduino, it is working perfectly. Recently I have integrated with Ethernet W5500. The Ethernet connection is working with MQTT PubSub module, but not with the Mdash. It is not able to connect. Kindly help me on the integration of Mdash with Ethernet.

Code:

void Com::Ethernet_Reconnect(){

  byte Eth_link = Ethernet.linkStatus();

  if(Eth_link == 1){ // If link is connected

    if(Eth_flg == 0){ // If not connected

      uint8_t mac[6];  
      esp_read_mac(mac, ESP_MAC_WIFI_STA);
      
      Serial.print("\n Ethernet Mac Address : ");
      Mac_Disp(mac);

      Serial.print("\n Ethernet Connecting..");

      if (Ethernet.begin(mac) == 0) {
        Serial.println("Failed to configure Ethernet using DHCP");
        Eth_flg = 0;
          // You can try a static IP if DHCP fails.
          // Ethernet.begin(mac, ip);
      }

      else{
          Serial.print("\n DHCP comfigured Successfully");
          Eth_flg = 1;
      }
    }
  }

  else{
    Serial.print("\n Link is not connected");
    Eth_flg = 0;
  }
}

Com COM;
    OTA OT;

    WiFiClient *Wifi;
    EthernetClient *EthClient;
    
    
    COM.WiFi_Connect("Service", "12345678", 10000); // For 10 sec, timeout    
    COM.WiFi_Range(); // Wifi Range Display
/*
    Wifi = new WiFiClient();
    COM.MQTT_SetClient(*Wifi); // Pubsub default as Wifi Client
*/

    COM.Ethernet_init(LAN_cs);
    COM.Ethernet_Reconnect();
    EthClient = new EthernetClient();
    COM.MQTT_SetClient(*EthClient); // Pubsub default as Wifi Client


    OT.Mdash_Begin("8bHnIEYfB3AlzrTVMoWeTQ");

    
    COM.TCP_Connect("broker.hivemq.com", 1883); // Wifi based TCP connect

    while(1){

        COM.MQTT_Connect("Therm1");

        //COM.CheckIP_Reconnect("Therm1", "NBST1");

        uint8_t Pub_stat = COM.MQTT_Publish("thermelgy", "{Hello}");
    
        if (Pub_stat == 1)
            Serial.printf("Successfully sent to cloud\n");
        
        else
            Serial.println("\n Failed sent to Cloud");

        delay(10000);
    }
}

Debug log:

rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0030,len:1184
load:0x40078000,len:13192
load:0x40080400,len:3028
entry 0x400805e4
E (425) esp_core_dump_flash: No core d3f
�partition found!
E (425) esp_core_dump_flash: No core dump partition found!
[     7][D][esp32-hal-cpu.c:244] setCpuFrequencyMhz(): PLL: 480 / 2 = 240 Mhz, APB: 80000000 Hz
[   459][I][esp32-hal-psram.c:96] psramInit(): PSRAM enabled
Connecting to: Service
[  2495][D][WiFiGeneric.cpp:1035] _eventCallback(): Arduino Event: 0 - WIFI_READY
[  2591][V][WiFiGeneric.cpp:97] set_esp_interface_ip(): Configuring Station static IP: 0.0.0.0, MASK: 0.0.0.0, GW: 0.0.0.0
[  2589][V][WiFiGeneric.cpp:340] _arduino_event_cb(): STA Started
[  2596][D][WiFiGeneric.cpp:1035] _eventCallback(): Arduino Event: 2 - STA_START
----[  5013][V][WiFiGeneric.cpp:362] _arduino_event_cb(): STA Disconnected: SSID: Service, BSSID: 00:00:00:00:00:00, Reason: 201
[  5013][D][WiFiGeneric.cpp:1035] _eventCallback(): Arduino Event: 5 - STA_DISCONNECTED
[  5021][W][WiFiGeneric.cpp:1057] _eventCallback(): Reason: 201 - NO_AP_FOUND
[  5028][D][WiFiGeneric.cpp:1077] _eventCallback(): WiFi Reconnect Running
[  5036][V][WiFiGeneric.cpp:97] set_esp_interface_ip(): Configuring Station static IP: 0.0.0.0, MASK: 0.0.0.0, GW: 0.0.0.0
-----[  7458][V][WiFiGeneric.cpp:362] _arduino_event_cb(): STA Disconnected: SSID: Service, BSSID: 00:00:00:00:00:00, Reason: 201
[  7458][D][WiFiGeneric.cpp:1035] _eventCallback(): Arduino Event: 5 - STA_DISCONNECTED
[  7466][W][WiFiGeneric.cpp:1057] _eventCallback(): Reason: 201 - NO_AP_FOUND
[  7473][D][WiFiGeneric.cpp:1081] _eventCallback(): WiFi AutoReconnect Running
[  7481][V][WiFiGeneric.cpp:97] set_esp_interface_ip(): Configuring Station static IP: 0.0.0.0, MASK: 0.0.0.0, GW: 0.0.0.0
-----[  9903][V][WiFiGeneric.cpp:362] _arduino_event_cb(): STA Disconnected: SSID: Service, BSSID: 00:00:00:00:00:00, Reason: 201
[  9904][D][WiFiGeneric.cpp:1035] _eventCallback(): Arduino Event: 5 - STA_DISCONNECTED
[  9911][W][WiFiGeneric.cpp:1057] _eventCallback(): Reason: 201 - NO_AP_FOUND
[  9918][D][WiFiGeneric.cpp:1081] _eventCallback(): WiFi AutoReconnect Running
[  9926][V][WiFiGeneric.cpp:97] set_esp_interface_ip(): Configuring Station static IP: 0.0.0.0, MASK: 0.0.0.0, GW: 0.0.0.0
-----[ 12348][V][WiFiGeneric.cpp:362] _arduino_event_cb(): STA Disconnected: SSID: Service, BSSID: 00:00:00:00:00:00, Reason: 201
[ 12349][D][WiFiGeneric.cpp:1035] _eventCallback(): Arduino Event: 5 - STA_DISCONNECTED
[ 12356][W][WiFiGeneric.cpp:1057] _eventCallback(): Reason: 201 - NO_AP_FOUND
[ 12363][D][WiFiGeneric.cpp:1081] _eventCallback(): WiFi AutoReconnect Running
[ 12372][V][WiFiGeneric.cpp:97] set_esp_interface_ip(): Configuring Station static IP: 0.0.0.0, MASK: 0.0.0.0, GW: 0.0.0.0
-
Failed on WiFi connection: Timeout
MAC address: 78:21:84:92:8D:24
WiFi range: 0 dBm

 Ethernet Mac Address : 78:21:84:92:8D:24
 Ethernet Connecting..
 DHCP comfigured Successfully37f3 2 mDash.c:117:mount_fs             FS -> /spiffs: 0
37fb 2 mDash.c:810:doinit               Initialised, id
Re-attempting to connect
382f 1 mongoose.c:406:mg_error          2 0x30 DNS send
3831 1 mongoose.c:406:mg_error          1 0xffffffff DNS error
Successfully sent to cloud
3c2e 1 mongoose.c:406:mg_error          4 0x30 DNS send
3c2f 1 mongoose.c:406:mg_error          3 0xffffffff DNS error
402c 1 mongoose.c:406:mg_error          6 0x30 DNS send
402d 1 mongoose.c:406:mg_error          5 0xffffffff DNS error
[ 17248][V][WiFiGeneric.cpp:362] _arduino_event_cb(): STA Disconnected: SSID: Service, BSSID: 00:00:00:00:00:00, Reason: 201
[ 17249][D][WiFiGeneric.cpp:1035] _eventCallback(): Arduino Event: 5 - STA_DISCONNECTED
[ 17256][W][WiFiGeneric.cpp:1057] _eventCallback(): Reason: 201 - NO_AP_FOUND
[ 17263][D][WiFiGeneric.cpp:1081] _eventCallback(): WiFi AutoReconnect Running
[ 17271][V][WiFiGeneric.cpp:97] set_esp_interface_ip(): Configuring Station static IP: 0.0.0.0, MASK: 0.0.0.0, GW: 0.0.0.0
43f7 1 mongoose.c:406:mg_error          8 0x30 DNS send
43f8 1 mongoose.c:406:mg_error          7 0xffffffff DNS error
47f5 1 mongoose.c:406:mg_error          10 0x30 DNS send
47f6 1 mongoose.c:406:mg_error          9 0xffffffff DNS error
4bc0 1 mongoose.c:406:mg_error          12 0x30 DNS send
4bc1 1 mongoose.c:406:mg_error          11 0xffffffff DNS error
[ 19694][V][WiFiGeneric.cpp:362] _arduino_event_cb(): STA Disconnected: SSID: Service, BSSID: 00:00:00:00:00:00, Reason: 201
[ 19695][D][WiFiGeneric.cpp:1035] _eventCallback(): Arduino Event: 5 - STA_DISCONNECTED
[ 19702][W][WiFiGeneric.cpp:1057] _eventCallback(): Reason: 201 - NO_AP_FOUND
[ 19709][D][WiFiGeneric.cpp:1081] _eventCallback(): WiFi AutoReconnect Running
[ 19718][V][WiFiGeneric.cpp:97] set_esp_interface_ip(): Configuring Station static IP: 0.0.0.0, MASK: 0.0.0.0, GW: 0.0.0.0
4fbe 1 mongoose.c:406:mg_error          14 0x30 DNS send
4fbf 1 mongoose.c:406:mg_error          13 0xffffffff DNS error
5389 1 mongoose.c:406:mg_error          16 0x30 DNS send
538a 1 mongoose.c:406:mg_error          15 0xffffffff DNS error
[ 22140][V][WiFiGeneric.cpp:362] _arduino_event_cb(): STA Disconnected: SSID: Service, BSSID: 00:00:00:00:00:00, Reason: 201
[ 22141][D][WiFiGeneric.cpp:1035] _eventCallback(): Arduino Event: 5 - STA_DISCONNECTED
[ 22148][W][WiFiGeneric.cpp:1057] _eventCallback(): Reason: 201 - NO_AP_FOUND
[ 22155][D][WiFiGeneric.cpp:1081] _eventCallback(): WiFi AutoReconnect Running
[ 22164][V][WiFiGeneric.cpp:97] set_esp_interface_ip(): Configuring Station static IP: 0.0.0.0, MASK: 0.0.0.0, GW: 0.0.0.0
5787 1 mongoose.c:406:mg_error          18 0x30 DNS send
5788 1 mongoose.c:406:mg_error          17 0xffffffff DNS error
5b85 1 mongoose.c:406:mg_error          20 0x30 DNS send
5b86 1 mongoose.c:406:mg_error          19 0xffffffff DNS error
5f50 1 mongoose.c:406:mg_error          22 0x30 DNS send
5f51 1 mongoose.c:406:mg_error          21 0xffffffff DNS error
[ 24587][V][WiFiGeneric.cpp:362] _arduino_event_cb(): STA Disconnected: SSID: Service, BSSID: 00:00:00:00:00:00, Reason: 201
[ 24587][D][WiFiGeneric.cpp:1035] _eventCallback(): Arduino Event: 5 - STA_DISCONNECTED
[ 24595][W][WiFiGeneric.cpp:1057] _eventCallback(): Reason: 201 - NO_AP_FOUND
[ 24602][D][WiFiGeneric.cpp:1081] _eventCallback(): WiFi AutoReconnect Running
[ 24610][V][WiFiGeneric.cpp:97] set_esp_interface_ip(): Configuring Station static IP: 0.0.0.0, MASK: 0.0.0.0, GW: 0.0.0.0
Connected to Therm1
Successfully sent to cloud
634e 1 mongoose.c:406:mg_error          24 0x30 DNS send
634f 1 mongoose.c:406:mg_error          23 0xffffffff DNS error
6719 1 mongoose.c:406:mg_error          26 0x30 DNS send
671a 1 mongoose.c:406:mg_error          25 0xffffffff DNS error
[ 27033][V][WiFiGeneric.cpp:362] _arduino_event_cb(): STA Disconnected: SSID: Service, BSSID: 00:00:00:00:00:00, Reason: 201
[ 27034][D][WiFiGeneric.cpp:1035] _eventCallback(): Arduino Event: 5 - STA_DISCONNECTED
[ 27041][W][WiFiGeneric.cpp:1057] _eventCallback(): Reason: 201 - NO_AP_FOUND
[ 27048][D][WiFiGeneric.cpp:1081] _eventCallback(): WiFi AutoReconnect Running
[ 27056][V][WiFiGeneric.cpp:97] set_esp_interface_ip(): Configuring Station static IP: 0.0.0.0, MASK: 0.0.0.0, GW: 0.0.0.0
6b17 1 mongoose.c:406:mg_error          28 0x30 DNS send
6b18 1 mongoose.c:406:mg_error          27 0xffffffff DNS error
6ee2 1 mongoose.c:406:mg_error          30 0x30 DNS send
6ee3 1 mongoose.c:406:mg_error          29 0xffffffff DNS error
72e0 1 mongoose.c:406:mg_error          32 0x30 DNS send
72e1 1 mongoose.c:406:mg_error          31 0xffffffff DNS error

PlatformIO .ini file:

[env:esp32dev]
platform = [email protected]
board = esp32dev
framework = arduino
board_upload.flash_size = 16MB
board_upload.maximum_size = 16777216
monitor_speed = 115200
monitor_filters = esp32_exception_decoder
lib_deps = 
knolleary/[email protected]
https://github.com/Thermelgy-Repo/mDash.git#V1.2.17X3
[email protected]
build_flags = 
	-Isdkconfig
	-DLOG_LEVEL=LOG_LEVEL_VERBOSE
	-DCORE_DEBUG_LEVEL=5

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.