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

Any luck compiling with Arduino ESP-32 3.x.x? #440

Open
andcolla80 opened this issue Sep 16, 2024 · 1 comment
Open

Any luck compiling with Arduino ESP-32 3.x.x? #440

andcolla80 opened this issue Sep 16, 2024 · 1 comment

Comments

@andcolla80
Copy link

I can compile without issues using arduino-esp32 based on ESP-IDF 4.4, but have a lot of error when try to use the same code with some version (3.x.x) based on ESP-IDF 5.x.

My guess is some code is not compatible with the new standard GNU++17 used by GCC 11.

Does anyone ported this code to new api version?

@andcolla80
Copy link
Author

andcolla80 commented Sep 17, 2024

Maybe I found the solution. I changed the menuIO/chainStream.h to the code below and successfully compiled using VSCode, ESP-IDF 5.1.4 and arduino-esp32 3.0.4. These are the latest versions, not tried with 3.1.0-rc1.

// menuIO/chainStream.h

#ifndef MENU_CHAINSTREAM_H
#define MENU_CHAINSTREAM_H

#include <Arduino.h>
#include "../menu.h"

namespace Menu {

  template<int N>
  class chainStream:public menuIn {
    public:
    menuIn* const* const inputs;
    chainStream(menuIn* const* inputs):inputs(inputs) {}
    int available(void) override {
      for(int n=0;n<N;n++) {
        int r=inputs[n]->available();
        if (r) return r;
      }
      return 0;
    }
    int peek(void) override {
      for(int n=0;n<N;n++) {
        int r=inputs[n]->peek();
        if (r>=0) return r;
      }
      return -1;
    }
    int read(void) override {
      for(int n=0;n<N;n++) {
        int r=inputs[n]->read();
        if (r>=0) return r;
      }
      return -1;
    }
    void flush(void) override {
      for(int n=0;n<N;n++) inputs[n]->flush();
    }
    size_t write(uint8_t v) override {
      for(int n=0;n<N;n++) inputs[n]->write(v);
      return 1;
    }
  };

} // namespace Menu

#endif

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

1 participant