Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ring Buffer on arduino zero. #161

Open
gioreva opened this issue Oct 7, 2018 · 8 comments
Open

Ring Buffer on arduino zero. #161

gioreva opened this issue Oct 7, 2018 · 8 comments

Comments

@gioreva
Copy link

gioreva commented Oct 7, 2018

Trying to compile for zero I have this error that I do not understand.

`Arduino: 1.8.5 (Windows 10), Board: "GEVINO SAM-BA bootloader"

In file included from C:\Users\x-gio\Documents\Arduino\libraries\WiFiEsp\src/utility/EspDrv.h:26:0,

             from C:\Users\x-gio\Documents\Arduino\libraries\WiFiEsp\src/WiFiEsp.h:30,

             from D:\del\WebServerAP\WebServerAP.ino:14:

C:\Users\x-gio\Documents\Arduino\libraries\WiFiEsp\src/utility/RingBuffer.h:23:7: error: using typedef-name 'RingBuffer' after 'class'

class RingBuffer

   ^

In file included from C:\Users\x-gio\AppData\Local\Arduino15\packages\arduino\hardware\samd\1.6.19\cores\arduino/Uart.h:23:0,

             from C:\Users\x-gio\AppData\Local\Arduino15\packages\arduino\hardware\samd\1.6.19\variants\arduino_zero/variant.h:43,

             from C:\Users\x-gio\AppData\Local\Arduino15\packages\arduino\hardware\samd\1.6.19\cores\arduino/delay.h:23,

             from C:\Users\x-gio\AppData\Local\Arduino15\packages\arduino\hardware\samd\1.6.19\cores\arduino/Arduino.h:81,

             from sketch\WebServerAP.ino.cpp:1:

C:\Users\x-gio\AppData\Local\Arduino15\packages\arduino\hardware\samd\1.6.19\cores\arduino/RingBuffer.h:54:41: note: 'RingBuffer' has a previous declaration here

typedef RingBufferN<SERIAL_BUFFER_SIZE> RingBuffer;

                                     ^

WebServerAP:25: error: no matching function for call to 'RingBufferN<64>::RingBufferN(int)'

RingBuffer buf(8);

             ^

D:\del\WebServerAP\WebServerAP.ino:25:17: note: candidates are:

In file included from C:\Users\x-gio\AppData\Local\Arduino15\packages\arduino\hardware\samd\1.6.19\cores\arduino/Uart.h:23:0,

             from C:\Users\x-gio\AppData\Local\Arduino15\packages\arduino\hardware\samd\1.6.19\variants\arduino_zero/variant.h:43,

             from C:\Users\x-gio\AppData\Local\Arduino15\packages\arduino\hardware\samd\1.6.19\cores\arduino/delay.h:23,

             from C:\Users\x-gio\AppData\Local\Arduino15\packages\arduino\hardware\samd\1.6.19\cores\arduino/Arduino.h:81,

             from sketch\WebServerAP.ino.cpp:1:

C:\Users\x-gio\AppData\Local\Arduino15\packages\arduino\hardware\samd\1.6.19\cores\arduino/RingBuffer.h:58:1: note: RingBufferN::RingBufferN() [with int N = 64]

RingBufferN::RingBufferN( void )

^

C:\Users\x-gio\AppData\Local\Arduino15\packages\arduino\hardware\samd\1.6.19\cores\arduino/RingBuffer.h:58:1: note: candidate expects 0 arguments, 1 provided

C:\Users\x-gio\AppData\Local\Arduino15\packages\arduino\hardware\samd\1.6.19\cores\arduino/RingBuffer.h:33:7: note: constexpr RingBufferN<64>::RingBufferN(const RingBufferN<64>&)

class RingBufferN

   ^

C:\Users\x-gio\AppData\Local\Arduino15\packages\arduino\hardware\samd\1.6.19\cores\arduino/RingBuffer.h:33:7: note: no known conversion for argument 1 from 'int' to 'const RingBufferN<64>&'

C:\Users\x-gio\AppData\Local\Arduino15\packages\arduino\hardware\samd\1.6.19\cores\arduino/RingBuffer.h:33:7: note: constexpr RingBufferN<64>::RingBufferN(RingBufferN<64>&&)

C:\Users\x-gio\AppData\Local\Arduino15\packages\arduino\hardware\samd\1.6.19\cores\arduino/RingBuffer.h:33:7: note: no known conversion for argument 1 from 'int' to 'RingBufferN<64>&&'

D:\del\WebServerAP\WebServerAP.ino: In function 'void loop()':

WebServerAP:64: error: 'RingBuffer' has no member named 'init'

 buf.init();                               // initialize the circular buffer

     ^

WebServerAP:68: error: 'RingBuffer' has no member named 'push'

     buf.push(c);                          // push it to the ring buffer

         ^

WebServerAP:72: error: 'RingBuffer' has no member named 'endsWith'

     if (buf.endsWith("\r\n\r\n")) {

             ^

exit status 1
no matching function for call to 'RingBufferN<64>::RingBufferN(int)'

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
`

@JAndrassy
Copy link

JAndrassy commented Oct 7, 2018

it is a conflict of two types with the same name RingBuffer. One is in SAMD Arduino core and second in WiFiEsp library. WiFiEsp was not tested and adjusted for SAMD boards

solution #27

@gioreva
Copy link
Author

gioreva commented Oct 7, 2018

Changed all RingBuffer with RingbufferW

Now error are this:

What is va_list ?

`Arduino: 1.8.5 (Windows 10), Board: "GEVINO SAM-BA bootloader"

C:\Users\x-gio\Documents\Arduino\libraries\WiFiEsp\src\utility\EspDrv.cpp: In static member function 'static int EspDrv::sendCmd(const __FlashStringHelper*, int, ...)':

C:\Users\x-gio\Documents\Arduino\libraries\WiFiEsp\src\utility\EspDrv.cpp:1019:2: error: 'va_list' was not declared in this scope

va_list args;

^

C:\Users\x-gio\Documents\Arduino\libraries\WiFiEsp\src\utility\EspDrv.cpp:1019:10: error: expected ';' before 'args'

va_list args;

      ^

C:\Users\x-gio\Documents\Arduino\libraries\WiFiEsp\src\utility\EspDrv.cpp:1020:12: error: 'args' was not declared in this scope

va_start (args, timeout);

        ^

C:\Users\x-gio\Documents\Arduino\libraries\WiFiEsp\src\utility\EspDrv.cpp:1020:25: error: 'va_start' was not declared in this scope

va_start (args, timeout);

                     ^

C:\Users\x-gio\Documents\Arduino\libraries\WiFiEsp\src\utility\EspDrv.cpp:1021:56: error: 'vsnprintf_P' was not declared in this scope

vsnprintf_P (cmdBuf, CMD_BUFFER_SIZE, (char*)cmd, args);

                                                    ^

C:\Users\x-gio\Documents\Arduino\libraries\WiFiEsp\src\utility\EspDrv.cpp:1022:14: error: 'va_end' was not declared in this scope

va_end (args);

          ^

exit status 1
Error compiling for board GEVINO SAM-BA bootloader.

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
`

@gioreva
Copy link
Author

gioreva commented Oct 7, 2018

Putting __gnuc_va_list args; solve this problem.
But putting __gnuc_va_start and __gnuc_va_end not solve next problem.
Also vsnprintf_P give me problem.

int EspDrv::sendCmd(const __FlashStringHelper* cmd, int timeout, ...)
{
char cmdBuf[CMD_BUFFER_SIZE];
__gnuc_va_list args;
__gnuc_va_start (args, timeout);
vsnprintf_P (cmdBuf, CMD_BUFFER_SIZE, (char*)cmd, args);
__gnuc_va_end (args);

@gioreva
Copy link
Author

gioreva commented Oct 10, 2018

I have solved all the compilation issues this way, but it seems to not Work.

Changed RingBuff Class on RingBuffW
Added on EspDrv.cpp
#include <stdarg.h>
#include <stdio.h>
Changed on EspDrv.cpp
vsnprintf_P (cmdBuf, CMD_BUFFER_SIZE, (char*)cmd, args);
with
vsnprintf (cmdBuf, CMD_BUFFER_SIZE, (char*)cmd, args);

How is the equivalent of Vsnprintf_P with ARM ?

@gioreva
Copy link
Author

gioreva commented Oct 10, 2018

WiFi.init(&Serial);
Can i use also with hardware serial ?

@gioreva
Copy link
Author

gioreva commented Oct 10, 2018

This exactly my change.

Changed on RingBuffer.cpp & RingBuffer.h & EspDrv.cpp & EspDrv.h & Scketh
RingBuff Class on RingBuffW
Added on EspDrv.cpp
#include <stdarg.h>
Changed on EspDrv.cpp
vsnprintf_P (cmdBuf, CMD_BUFFER_SIZE, (char*)cmd, args);
with
vsnprintf (cmdBuf, CMD_BUFFER_SIZE, (char*)cmd, args);

But unit reboot each fiew seconds.
ESP led, blink repeatedly every few seconds, USB driver disappears and Returns.

@gioreva
Copy link
Author

gioreva commented Oct 10, 2018

Ok, no, all Work Well.

Only small problem.
On USB debug Appears IP 0.0.0.0
But really work well at 192.168.1.1

@gioreva
Copy link
Author

gioreva commented Oct 15, 2018

AT+GMR
AT version:1.1.0.0(May 11 2016 18:09:56)
SDK version:1.5.4(baaeaebb)
Ai-Thinker Technology Co. Ltd.
Jun 13 2016 11:29:20
OK

All example work, but on all example, says always IP 0.0.0.0
Can you help me to solve problem ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants