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

Missing WProgram.h #4

Closed
bxparks opened this issue Aug 9, 2021 · 8 comments
Closed

Missing WProgram.h #4

bxparks opened this issue Aug 9, 2021 · 8 comments

Comments

@bxparks
Copy link
Collaborator

bxparks commented Aug 9, 2021

Moved from bxparks/AUnit#75


Hi Brian

My unit tests are broken due to WProgram.h missing (here)

This files has gone when I have acecpted your PR on EspMock.

I may be wrong as this is the first time I'm using EPOXY_CORE as I wanted my unit tests to pass since this modification.

Best regards


@bxparks
Copy link
Collaborator Author

bxparks commented Aug 9, 2021

I'm a bit confused, there was no WProgram.h file checked into this project. The list of files that I removed in my most recent commit is the following, and there is no WProgram.h.

$ git show --stat
commit c47d1144d946e1a6b5008c10ca372838f73cbc95 (HEAD -> main, origin/main, origin/HEAD)
Author: Brian Park <brian@xparks.net>
Date:   Fri Aug 6 16:20:49 2021 -0700

    Merge cores/esp8266/* directly into EpoxyDuino/cores/epoxy/*, guarded by EPOXY_CORE_ESP8266 macro

 README.md                     |   5 +-
 cores/esp8266/Arduino.cpp     |  81 --------------
 cores/esp8266/Arduino.h       | 280 ----------------------------------------------
 cores/esp8266/Client.h        |  52 ---------
 cores/esp8266/Esp.cpp         |   3 -
 cores/esp8266/Esp.h           |  39 -------
 cores/esp8266/IPAddress.cpp   | 116 -------------------
 cores/esp8266/IPAddress.h     |  74 -------------
 cores/esp8266/Print.cpp       | 285 -----------------------------------------------
 cores/esp8266/Print.h         |  99 -----------------
 cores/esp8266/Printable.h     |  41 -------
 cores/esp8266/StdioSerial.cpp |  18 ---
 cores/esp8266/StdioSerial.h   |  68 ------------
 cores/esp8266/Stream.cpp      | 320 ----------------------------------------------------
 cores/esp8266/Stream.h        | 139 -----------------------
 cores/esp8266/WCharacter.h    | 169 ----------------------------
 cores/esp8266/WString.cpp     | 751 ---------------------------------------------------------------------------------------------------------------------------
 cores/esp8266/WString.h       | 228 --------------------------------------
 cores/esp8266/avr_stdlib.cpp  | 157 --------------------------
 cores/esp8266/avr_stdlib.h    |  27 -----
 cores/esp8266/main.cpp        | 131 ----------------------
 cores/esp8266/pgmspace.h      |  42 -------
 cores/esp8266/pins_arduino.h  |  55 ---------
 tests/network-tests/Makefile  |   2 +-
 24 files changed, 3 insertions(+), 3179 deletions(-)

(Edit: typo, that -> what)
I'm also confused what WProgram.h is supposed to contain. I see it only on the SpenceKonde/ATTinyCore project, and it contains basically nothing:

#ifndef WProgram_h
#define WProgram_h

#endif

@bxparks
Copy link
Collaborator Author

bxparks commented Aug 9, 2021

I played around with your tests in TinyMqtt/tests/, and I found some interesting things.

1)) In src/MqttStreaming.h, you have something like:

#if (defined(ARDUINO) && ARDUINO >= 100)
#include "Arduino.h"
#else
#ifndef STREAMING_CONSOLE
#include "WProgram.h"
#endif
#endif

I think you need something like:

#if (defined(ARDUINO) && ARDUINO >= 100) || defined(EPOXY_DUINO)

In the same file, you have something like:

#if ARDUINO >= 18

I think that should be replaced by:

#if ARDUINO >= 18 || defined(EPOXY_DUINO)

2)) There's a bunch of errors regarding _FLOAT, because your version of EpoxyDuino/cores/epoxy/Esp.h defines a struct _FlOAT, but your MqttStreaming.h file also defines a _FLOAT so there is a collision. I think the solution is to remove the version of _FLOAT in EpoxyDuino/cores/epoxy/Esp.h:

class _FLOAT
{
  public:
    int digits;
    float val;
};

I cannot find a class _FLOAT anywhere in the original ESP8266 core files, so I don't know where this came from.

3)) In the real ESP8266 core, there is a circular inclusion of<Arduino.h> and Esp.h. Each header includes the other, which is I think is a bug. In EpoxyDuino, Arduino.h does not include Esp.h, so there's an incompatibility there. I think the solution is for EpoxyDuino/Arduino.h to include Esp.h.

4)) Each *.ino file in tests/ should probably begin with #include <Arduino.h>. The Arduino compiler automatically inserts Arduino.h at the top of the *.ino file. But EpoxyDuino treats a *.ino file as a normal .cpp file. So it must have an #include <Arduino.h> at the top of the file.

@bxparks
Copy link
Collaborator Author

bxparks commented Aug 9, 2021

Oh I see, I removed WProgram.h in #3, back in April 29, not in the most recent commit.

I now have a vague recollection: WProgram.h was used in a previous version of the Arduino API, many years before I started programming on Arduino. I believe it is obsolete, so I don't think it belongs in EpoxyDuino. No recent Core seems to have it (AVR, SAMD, STM32, ESP8266, ESP32).

bxparks added a commit to bxparks/EpoxyDuino that referenced this issue Aug 9, 2021
@bxparks
Copy link
Collaborator Author

bxparks commented Aug 9, 2021

Sent you hsaturn/TinyMqtt#15 to fix broken tests.

@hsaturn
Copy link
Owner

hsaturn commented Aug 9, 2021

Thanks for all Brian

The MqttStreaming.h is not really mine, I kept almost the file as it was from its author, removing WProgram.h (or re-adding it somewhere in EpoxyDuino) did not solved the problem for me yesterday (Serial not declared).

Tests are now working on my local clones of the four repositories.
But AUnit is still broken in github for TinyMqtt (Serial).

I'm not sure what happen because I run tests successfully on my virtual machine few minutes ago after having merged pulled your PR, but they are now failing on "Serial".
All my repos are up to date...

I'll have a longer look this evening

Best regards.

@hsaturn
Copy link
Owner

hsaturn commented Aug 9, 2021

Hi, finaly I could not resist to do that now (I should work instead....grr)

I've fixed the problem that was in EspMock in this commit

Thanks for all Brian

@bxparks
Copy link
Collaborator Author

bxparks commented Aug 9, 2021

Glad that you got it working. I forgot that you were using EpoxyDuino/EspMock for your TinyMqtt project. Sorry for the trouble, but I think the bit of pain was worth it. Things are a lot cleaner now with the EPOXY_CORE = EPOXY_CORE_ESP8266 option, with all the necessary code for ESP8266 merged into EpoxyDuino.

@bxparks
Copy link
Collaborator Author

bxparks commented Aug 19, 2021

I think this is all resolved, so closing to clean up clutter in my to-do list.

@bxparks bxparks closed this as completed Aug 19, 2021
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