These are chat archives for esp8266/Arduino

Apr 2016
Apr 22 2016 02:46
anyone doing the new rtos? I'm about to move all my code over
Michael Miller
Apr 22 2016 06:36
@physiii Why?
Apr 22 2016 07:01
Regarding the WiFi.disconnect() crash, when I call this method, this is the crash log I'm seeing:

Exception (3):
epc1=0x4000deed epc2=0x00000000 epc3=0x00000000 excvaddr=0x40000014 depc=0x00000000

ctx: cont
sp: 3fff5a10 end: 3fff5cd0 offset: 01a0

3fff5bb0: 4010623e 3fffb2ac 000000ff 00000000
3fff5bc0: 40235be9 3fffb36c 00000484 00000000
3fff5bd0: 3fffb42c 3fff5c81 00000001 40235d3c
3fff5be0: 3fff5c20 3fffb36c 00000009 3fff4ca0
3fff5bf0: 3fff5c40 3ffffed0 3fffb36c 00000009
3fff5c00: 40235d78 3fff5d18 00000000 40214c65
3fff5c10: 402088ec 3fff40dc 3fff4cb0 3fff5d18
3fff5c20: 00000000 00000000 40211828 39ff4cb0
3fff5c30: 3fff4000 00000001 3ffe903d 40214a60
3fff5c40: 00000000 00000006 3ffe8eee 3fff4ca0
3fff5c50: 00000009 00000001 3fff5d18 40211fc9
3fff5c60: 3ffe903c 00000009 3fff5d18 40214cc3
3fff5c70: 3ffe8ee8 3fff38fc 3fff5d18 40214b38
3fff5c80: 00000009 3fff38dc 3fff5d18 40214cf5
3fff5c90: 3fff385c 3fff38dc 3fff5d18 402079d3
3fff5ca0: 00000000 00000000 00000001 3fff4ca0
3fff5cb0: 3fffdad0 00000000 3fff4c98 40211874
3fff5cc0: feefeffe feefeffe 3fff4cb0 40100958

ets Jan 8 2013,rst cause:1, boot mode:(3,6)

load 0x4010f000, len 1264, room 16
tail 0
chksum 0x42
csum 0x42

Any idea why?
Should I close active connections first?
This message was deleted
Lars Englund
Apr 22 2016 07:11

What is the best practice / simplest way of enabling and disabling debug printouts? Currently I use

#define DEBUG_PRINT(x) Serial.print(x)
#define DEBUG_PRINTLN(x) Serial.println(x)
#define DEBUG_PRINTF(x, ...) Serial.printf(x, ...)

and then just empty-define them when I want to turn off debug printouts...

Apr 22 2016 07:14
there s something in the documentation of the core that would let you enable /disable debug using the arduino ide tools menu
if that helps
Lars Englund
Apr 22 2016 07:25
@tzapu thanks!
Hmm.. is this related to me just updating to arduino 1.6.8 and esp 2.2.0?
In file included from D:\bitbucket\exxact\Firmware\EDWD\EDWD.ino:11:0:

C:\Users\englund\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.2.0\cores\esp8266/Arduino.h:42:14: error: expected identifier before numeric constant

 #define HIGH 0x1

after that follows alot of errors about the expansion of the macro HIGH..
The wifi scan example compiles just fine
Apr 22 2016 07:35
@larsenglund no probs, don t know about the other thing..
Lars Englund
Apr 22 2016 07:36
Apparently an update to the Keypad library did a #define CLOSED HIGH in Keypad.h which seemed to be the source of the problem. Redefining it to #define BTN_CLOSED HIGH made the errors go away..
It was colliding with a definition of CLOSED in some WiFi stuff..
Helio Machado
Apr 22 2016 08:54
@all the Benoit Blanchon ArduinoJson users: Only a question:
File configFile ="/config.json", "r");
  size_t size = configFile.size();
  std::unique_ptr<char[]> buf(new char[size]);
  StaticJsonBuffer<200> jsonBuffer;
  JsonObject& root = jsonBuffer.parseObject(buf.get());
    bool a = root["a"];
  bool b = root["b"];
  Serial.print("A: ");
  Serial.print("B: ");
config.json contents:
{"a": false, "b": true}
Why the above code returns both values as false?
A: 0
B: 0
I've checked the file on the spiffs, and it looks good.
Helio Machado
Apr 22 2016 08:59
Going offline for half an hour. See you later!
Helio Machado
Apr 22 2016 10:57
Silly error!
I missed to add configFile.readBytes(buf.get(), size);
Holger Lembke
Apr 22 2016 11:10
For a while now I try to build uploading to my esp-12 with CH340T. Works great with manual reset/prog-jumper.
or better: IDE/esptool thinks it is uploading, ESP-12 seems to see something, too. But reset does not work and serial monitor is dead.
Looking on the data lines (reset and gpio0) it looks like everything goes totally wrong.
and I have no real idea where to start to fix it.
Any suggestions?
Holger Lembke
Apr 22 2016 14:16
(Addendum: building the Nodemcu solution and it works instantly...)
Apr 22 2016 16:45
holgerlembke, I believe the issue you see is to do with the DTR / RTS lines the nodeMCU set up uses these lines to control GPIO 0 and GPIO 2 during the re-flashing of the ESP. The standard download or manual reset does not use these lines (DTR/RTS). I had exactly the same issue as you using a CH340 and found that I could download prpoerly by using the nodeMCU option. However, once downloaded my code did not run as expected so I need to check and see if GPIO 0 and GPIO 2 are returned to the correct state for normal running after the flash download. If GPIO 0 is held low for some reason then the ESP will remain in the 'flash down load mode.
Holger Lembke
Apr 22 2016 16:52
@bobcroft, yes, thats it. after flashing and with open monitor both lines (reset & dtr) are low. so after reset we end in uart flash mode again.
boils down to the fact that above schematic is kaputt.
oh, and I see spikes on my DTR line around every second or so.
Apr 22 2016 18:33
Question for boffins... I'm trying to write a method of communication between arduinos and ESP8266 using pjon. I was using arduinojson as the packet structure, but this is very inefficient... I want to create a struct, send it byte by byte, then memcpy it into the struct declared at the other end. This works great... for arduino to arduino... but the problem is that types are different sizes on ESP8266... (not quite figured out which ones yet) but it makes this not so straight forward. Does anyone have any bright ideas.. easy solutions... or examples that are out there... before i struggle and spend lots of time trying to work one out! any help appreciated...
Me No Dev
Apr 22 2016 18:40
uint8_t is uint8_t everywhere. Same goes for uint16_t and uint32_t
Keith Andrew Hill
Apr 22 2016 18:40
Whatever you do, just make sure that your structs are using primitive types that are supported directly by the processor architecture of both systems.
Me No Dev
Apr 22 2016 18:40
int is not the same
Apr 22 2016 18:40
ok... that might be where the issue is..
Me No Dev
Apr 22 2016 18:40
word, size_t, things like that are platform dependent
Apr 22 2016 18:40
i guess enum is too
Keith Andrew Hill
Apr 22 2016 18:40
uint_8 or uint_16 bit etc
Apr 22 2016 18:40
Keith Andrew Hill
Apr 22 2016 18:41
Floats are dangerous.
And mostly unnecessary as you can represent them (with some mi
Minor loss of resolution) via conversion to an int by multiplying them by some large value.
123.123 could be multiplied by 1000 to result in 123123
Google does this for example to solve for currency storage by multiplying the original value by 1000000
Apr 22 2016 18:46
ah that makes sense.
Keith Andrew Hill
Apr 22 2016 18:46
The other standards to look into are BSON and MessagePack.
Apr 22 2016 18:47
what about signed versions like int8_t... etc
Keith Andrew Hill
Apr 22 2016 18:48
Those are essentially stored the same way. The only difference is the lsb or msb in memory.
I almost never use signed int value as negative numbers are usually undesirable
Especially when dealing with security
At least in transit
Apr 22 2016 18:56
cool thanks... i think what i'll do is use the standard numbers... should work
see how i get one....
message pack looks interesting though
Apr 22 2016 20:02
Does anyone here have experience with the Wiced Feather?
Michael Miller
Apr 22 2016 21:45
@sticilface the other issue to be concerned with is if you have a structure that has uint16_t followed by a unint32_t; is the size of the struct 6 or 8 bytes? Both lengths are valid, to make it more standard you will have to wrap your struct with a #pragma pack (push,1) and then a #pragma pack(pop) to make sure the structure is packed by bytes. For enums, you should be able to define them typed like
enum MyEnum : uint8_t
Stavros Korokithakis
Apr 22 2016 23:04
does this library look at all useful to anyone?