These are chat archives for esp8266/Arduino

3rd
Mar 2016
Ivan Grokhotkov
@igrr
Mar 03 2016 05:40
Wow, Oak core looks familiar... https://github.com/digistump/OakCore
Michael Miller
@Makuna
Mar 03 2016 05:45
What is it? THE README DOESN'T EVEN GIVE AN OVERVIEW!
Michael Miller
@Makuna
Mar 03 2016 05:54
Mm, lots of misinformation in the pitch for kickstarter.
Ivan Grokhotkov
@igrr
Mar 03 2016 07:10
Started cleaning up and commiting some of my work on host- and device- based tests
First some host-side mocks and a few tests for the filesystem
Lars Englund
@larsenglund
Mar 03 2016 08:05
Has anyone used the esp8266_mdns library? I'm trying to make my own answer packet but get a size error and don't quite see how to fix it..
Lars Englund
@larsenglund
Mar 03 2016 08:42
Hmm, nm, it was having troubles because the library don't have support for sending all types of answers
So I guess I'll start adding support for sending queries and receiving answers to ESP8266mDNS instead..
Rohit Yermalkar
@romuye123
Mar 03 2016 11:27
hello, i am unable to see .hex file in the temp folder
using Arduino 1.6.5
i can see following
.cpp
.bin
.o
.elf
what would be the problem ?
Ivan Grokhotkov
@igrr
Mar 03 2016 11:50
what is the .hex file?
what should it contain?
Rohit Yermalkar
@romuye123
Mar 03 2016 11:57
the binary file when you compile .ino sketch file
Ivan Grokhotkov
@igrr
Mar 03 2016 11:58
that's .bin
Rohit Yermalkar
@romuye123
Mar 03 2016 11:58
ok then how do you upload .bin file to ESP ?
Ivan Grokhotkov
@igrr
Mar 03 2016 11:59
You can upload it from the IDE by clicking on "upload" button (Ctrl+U on Win / Cmd+U on Mac)
Rohit Yermalkar
@romuye123
Mar 03 2016 12:00
i want to send the file to someone who does not have IDE
is there any way to directly upload .bin file to ESP ?
Ivan Grokhotkov
@igrr
Mar 03 2016 12:01
Yes, you can. Grab https://github.com/igrr/esptool-ck (see Releases page for binaries)
You can also use Espressif Flash Download Tools
Rohit Yermalkar
@romuye123
Mar 03 2016 12:02
i have mac OS
so let me check if i can do it
Ivan Grokhotkov
@igrr
Mar 03 2016 12:04
There is also esptool.py
Rohit Yermalkar
@romuye123
Mar 03 2016 12:05
ok
tzapu
@tzapu
Mar 03 2016 15:27
does anyone know how time works on the esp ?
i saw at some point there was some function call, that i can t remember that set time from ntp
would that time be kept in deep sleep ?
Ivan Grokhotkov
@igrr
Mar 03 2016 15:30
unfortunately there is no way to preserver time while waking from deep sleep
because GPIO16 pulls down reset, which resets contents of RTC memory
tzapu
@tzapu
Mar 03 2016 15:43
oh, but how can you save stuff to rtc memory then?
i mean i ve seen function calls to save to rtc, even a lib that uses them
Holger Lembke
@holgerlembke
Mar 03 2016 15:44
@tzapu get a ds3231 and let it do its job
tzapu
@tzapu
Mar 03 2016 15:44
@holgerlembke i know, i know, but if i can get away with just the esp, maybe i can explore that :)
i ve got a couple of rtc timers on order anyway
Martin Ayotte
@martinayotte
Mar 03 2016 15:45
I think that only RTC counter is been cleared, not the RTC RAM, so, time can be save there with sleep duration value added, on wakeup it can be restore with a small shift.
Ivan Grokhotkov
@igrr
Mar 03 2016 15:45
yep, @martinayotte is right.
only RTC counter gets cleared
Martin Ayotte
@martinayotte
Mar 03 2016 15:47
Yes, many I2C clocks such as PCF85263A and PCF8563A, or MCP79410.
tzapu
@tzapu
Mar 03 2016 15:47
ah ha
nice
ok
so doing that it would be enough to wake wifi every now and then
just to correct the shift
Martin Ayotte
@martinayotte
Mar 03 2016 15:48
Shopping Party ? :-)
tzapu
@tzapu
Mar 03 2016 15:48
NOOOOOO
not today
please
:P
Martin Ayotte
@martinayotte
Mar 03 2016 15:48
:-P
tzapu
@tzapu
Mar 03 2016 15:48
ended up with two rtc s with alarm last time
then resistor arrays
etc
:P
Martin Ayotte
@martinayotte
Mar 03 2016 15:50
Compulsive purchases ... ;-)
Holger Lembke
@holgerlembke
Mar 03 2016 15:51
lol
tzapu
@tzapu
Mar 03 2016 15:51
driven by compulsive components link sharers :))
cue @mozgy
:))
Martin Ayotte
@martinayotte
Mar 03 2016 15:51
I still have some others in my bag ;-)
tzapu
@tzapu
Mar 03 2016 15:51
i ll avoid you for a week or so
:))
still waiting on some esp8266 12f s to be delivered, taking their sweet time
Holger Lembke
@holgerlembke
Mar 03 2016 15:52
12f?
Martin Ayotte
@martinayotte
Mar 03 2016 15:52
Yes, sometime "slow-boat" is more "ultra-slow-boat"
holgerlembke @holgerlembke got something from hong kong today, got in mail yesterday...
Martin Ayotte
@martinayotte
Mar 03 2016 15:54
Yes, 12F and 12Q are simply refined/enhanced 12E, bigger Flash and different PCB antenna
tzapu
@tzapu
Mar 03 2016 15:54
oh ffs, have not seen the q so far
Holger Lembke
@holgerlembke
Mar 03 2016 15:56
bah. i spend my bugget on some MCP23017 and a keithley 2000. so no toys for me any more.
Martin Ayotte
@martinayotte
Mar 03 2016 15:56
The 12Q are black and have the AI cloud logo near the antenna. It was actually the first one that corrected the silkscreen error on GPIO4/GPIO5
Holger Lembke
@holgerlembke
Mar 03 2016 15:58
how many flash do the 12f and 12q have?
tzapu
@tzapu
Mar 03 2016 15:59
4MB
Martin Ayotte
@martinayotte
Mar 03 2016 15:59
By now, most ESP12E/F/Q has 4MB, only the older ESP12E had 512KB
Holger Lembke
@holgerlembke
Mar 03 2016 16:00
hmmmm. my oldest esp8266-12 already had 4mb. i'm confused
Martin Ayotte
@martinayotte
Mar 03 2016 16:01
Time passed, my first ones, 1 year ago, had only 512K. Now, let's hope some with 8MB or even 16MB will appear :-)
CHAE-PIL LIM
@chaeplin
Mar 03 2016 16:33
@tzapu DHT22 --> Temperature and humidity values are each read out the results of the last measurement.
Ivan Grokhotkov
@igrr
Mar 03 2016 16:34
:tada: we've got some coverage https://codecov.io/github/esp8266/Arduino
CHAE-PIL LIM
@chaeplin
Mar 03 2016 16:34
For real-time data that need continuous read twice, we recommend repeatedly to read sensors, and each read sensor interval is greater than 2 seconds to obtain accuratethe data. (manpage)
Michael Miller
@Makuna
Mar 03 2016 18:29
@igrr Code coverage from tests?! Do you have a target % you are aiming for?
Ivan Grokhotkov
@igrr
Mar 03 2016 18:30
Yes, that's coverage of the core files currently included into tests. Not all of them are included, so the real number is actually much lower :)
But once you start running tests measuring coverage is quite easy, so why not
Aditya Tannu
@AdySan
Mar 03 2016 18:31
will this cover sample sketches in the lib folder too?
or just the core, not sketches
Ivan Grokhotkov
@igrr
Mar 03 2016 18:32
No, these aren't currently "tests", these are just examples... Libraries will get some coverage as well, once i get to that
We will also have tests which run on the ESP, i'm setting up a RPi-based server with an ESP connected to it
However because my Linux and RPi skills suck, this is taking longer than I wanted to
Aditya Tannu
@AdySan
Mar 03 2016 18:33
cool
Ivan Grokhotkov
@igrr
Mar 03 2016 18:35
so i encourage everyone to go and write a test or two for the core
file system, number formatting and parsing functions, String, Print are good candidates
tests are pretty easy to write
I need to add some instructions on running them though :)
On Linux and OS X, you need to run make in tests/host/ directory
in theory, same should work on Windows with MinGW or Cygwin. however i haven't tested that.
If anyone with Windows gets a chance, please try and let me know
Dhawal
@thewall7
Mar 03 2016 20:57
Hey guys, has anyone tried to use PROGMEM for an array of struct ?
Michael Miller
@Makuna
Mar 03 2016 21:22
@dhawaladoshi Are you running into an issue? How are you defining it?
Michael Miller
@Makuna
Mar 03 2016 21:32
How are you consuming it?
frippe75
@frippe75
Mar 03 2016 21:38

Cannot work out this issue, not sure really it could be related to the esp wire library...
Supposed to read the battery voltage using i2c against my ATmega.
First sending my BR command to setup what data to be returned on the requestFrom...

    server.on ( "/battery", []() {
        // send i2c request to arduino
        Wire.beginTransmission(I2CSlaveDeviceId);
        Wire.write("BR\n"); // BR = Battery Reading, it will populate a replybuffer in the MyCommand object waiting to be read by a consequtive i2c command
        Wire.endTransmission(); 
        delay(30);
        Wire.requestFrom(I2CSlaveDeviceId, 6);    // request 6 bytes from slave

The ATmega code looks like

void MyCommand::requestEvent()
{
     #ifdef MYCOMMAND_DEBUG
          Serial.println("In requestEvent()");
   #endif

   Wire.write(replyBuffer); 
}

Matched means that I picked up the BR and executed batteryReading function filling my replyBuffer with 9.00 volt as a string.
But my requestEvent callback never fires... i.e "In requestEvent()" never shows up in the serial outut...

Output from serial on the ATmega:
Matched Command: BR
In batteryReadingCommand
replyBuffer:9.00

Martin Ayotte
@martinayotte
Mar 03 2016 21:51
Your handler seems to be a C++ method inside a class. did you try a plain function handler instead ?
Michael Miller
@Makuna
Mar 03 2016 21:55
Or make the method static.
frippe75
@frippe75
Mar 03 2016 21:55
Not really a c/C++ guy... I was having issues with this for the receiveEvent and I placed an empty wrapper function on top and called that one which solved it... Not really sure how.... :-(
static void requestEvent_wrapper() ??
not as a member function?
Martin Ayotte
@martinayotte
Mar 03 2016 21:58
As Makuna said you can make the method static if you wish be leave in it in the class. The problem is that when register the handler with Wire.onRequest(handler), there is no "this" passed to the class
Michael Miller
@Makuna
Mar 03 2016 22:03
Your running into a C++ism. Class members have a hidden first param, basically "this". Making it a static class member states its not instance specific and the hidden "this" is removed from the params. Declaring functions outside a class is the same as static member in the class, it just has the extra name space when you use it. ClassName::StaticMethodName();
frippe75
@frippe75
Mar 03 2016 22:09
I kind of understand. I alread had a static function declared outside of the class which was emtpy with the same name. Not sure how this worked... Need to wrap my head around static.
static void requestEventStatic()
{
   #ifdef MYCOMMAND_DEBUG
          Serial.println("In requestEvent()");
   #endif 
   Wire.write(MyCommand::replyBuffer);  
}
error: 'char MyCommand::replyBuffer [32]' is private
frippe75
@frippe75
Mar 03 2016 22:14
So just make that variable public?
Martin Ayotte
@martinayotte
Mar 03 2016 22:15
You could, or you can add a method getReplyBuffer(), as you wish
frippe75
@frippe75
Mar 03 2016 22:16
/usr/local/arduino-1.6.7/hardware/arduino/avr/libraries/Wire/Wire.h:73:10: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'void (*)()'
exit status 1
Sorry for just putting it out. Maybe I should start by consulting google :) ?
Martin Ayotte
@martinayotte
Mar 03 2016 22:19
Ah ! remove the static ! (static was mentioned by Makuna IF you leave the function as class method, not if it is a plain handler)
Those 2 "static" has totally different meaning ...
frippe75
@frippe75
Mar 03 2016 22:22
ok that's probably it... Cannot reach it... out of scope
Angus Gratton
@projectgus
Mar 03 2016 22:27
igrr: excited to see your automated test stuff going forward. I didn't realise you were doing host-based and device-based, very cool
the dedicated test hardware stuff has been pushed down my list a bit, there's a lot of low-hanging fruit you can test with just two ESPs (and some GPIOs joined together via series resistors)
so I want to get that fully integrated first
then specialised test hardware for peripheral functions, later
Ivan Grokhotkov
@igrr
Mar 03 2016 22:32
I'm also heading that route, although I decided to do the host-based tests first. The automated setup for esp-based tests kinda works, but I've had a hard time integrating it with Jenkins... Decided to put this off for a while and get back to that later
Angus Gratton
@projectgus
Mar 03 2016 22:34
I started looking at jenkins integration, but I think what I'll do is actually just set up an HTTP server local to me
and have Travis POST a test binary to it (along with an auth key) and it then runs the tests and returns back the result output
this seems like less messing around, and I don't have to worry as much about sandboxing my local environment if it's not running a host environment that it pulled from github
Dhawal
@thewall7
Mar 03 2016 22:38

@Makuna Thanks for the reply.
I got it working, the error I think was due to the conflict with F macro (which is used in a different function). If I remove the F macro, then it works great. Any idea why it's conflicting?

typedef struct {
    uint16_t        u16Id;               //Id
    uint8_t         u8AttributeFlags;   //flags
    teDataType        eAttributeDataType; //data type, enum defined some other .h
    const char*        sName;
}ts_Descriptor;

ts_Descriptor sDescOne[] PROGMEM = {
    {0x0000,(RD),UINT8,"MyString1"},
    {0x0001,(RD),UINT8,"MyString2"},
    {0x0002,(RD),UINT8,"MyString3"},
};

Compile Error:
C:\Users\MyUser\Documents\Arduino\libraries\Myprog\commands.cpp:1160:24: error: sDescOne causes a section type conflict with __c
ts_Descriptor sDescOne[] PROGMEM = {
^

In file included from C:\Users\MyUser\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.0.0\cores\esp8266/Arduino.h:245:0,
from C:\Users\MyUser\Documents\Arduino\libraries\Myprog\commands.cpp:31:

C:\Users\MyUser\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.0.0\cores\esp8266/pgmspace.h:18:51: note: 'c' was declared here
define PSTR(s) (
extension({static const char c[] PROGMEM = (s); &__c[0];}))
^

C:\Users\MyUser\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.0.0\cores\esp8266/WString.h:38:76: note: in definition of macro 'FPSTR'
define FPSTR(pstr_pointer) (reinterpret_cast<const __FlashStringHelper *>(pstr_pointer))
^

C:\Users\MyUser\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.0.0\cores\esp8266/WString.h:39:34: note: in expansion of macro 'PSTR'
define F(string_literal) (FPSTR(PSTR(string_literal)))
^

C:\Users\MyUser\Documents\Arduino\libraries\Myprog\commands.cpp:1263:16: note: in expansion of macro 'F'
Serial.print(F(", Myvars: "));
^

exit status 1
Error compiling.

Michael Miller
@Makuna
Mar 03 2016 23:11
@dhawaladoshi Well, you haven't given all the source to see, but the snippit you have copied works fine but does make one common mistake.
The strings in the initializer will not be stored in program memory as they are not marked as such. And you can't mark them as part of initialization, they must be initialized separately first. If you look at the Arduino Reference for Progmem, you will see an example of this with an array of strings and they go into details of it.
Michael Miller
@Makuna
Mar 03 2016 23:19
You maybe missing the const on the sDescOne. Here is what works for me (I am using the modern way to define enum/struct)
enum DataType {
  UINT8
};

#define RD 3

struct Descriptor {
    uint16_t        u16Id;               //Id
    uint8_t         u8AttributeFlags;   //flags
    DataType        eAttributeDataType; //data type, enum defined some other .h
    PGM_P       sName;
};

const char string_1[] PROGMEM = "MyString1";
const char string_2[] PROGMEM = "MyString2";
const char string_3[] PROGMEM = "MyString3";

const Descriptor sDescOne[] PROGMEM = {
    {0x0000,(RD),UINT8,string_1},
    {0x0001,(RD),UINT8,string_2},
    {0x0002,(RD),UINT8,string_3},
};
Dhawal
@thewall7
Mar 03 2016 23:20
@Makuna F was being used in a function that just loops through the table and prints the vars. Gonna try with your suggestion. Thanks a lot, appreciate it.
Michael Miller
@Makuna
Mar 03 2016 23:23
F() has lots of restrictions, but if you need to pass sName from above to something that normally takes a F(), wrap it with FPSTR(sName)
FPSTR is esp8266 specific by the way, I created it but there is no reason it wont work on others, they just didn't include it and we sort of need it to help with string pooling.
Dhawal
@thewall7
Mar 03 2016 23:35
Thank you very much :smile: