2

I'm rewriting a personal project and it doesn't compile under UECIDE 0.9.1, but it does with Arduino IDE 1.8.5.

Target is NodeMCU 0.9 with default options.

Arduino IDE 1.8.5

Archiving built core (caching) in: /tmp/arduino_cache_347503/core/core_esp8266_esp8266_nodemcu_CpuFrequency_80,UploadSpeed_115200,FlashSize_4M3M_4a642491bde0820b9be0f8ad42686d29.a
Sketch uses 299199 bytes (28%) of program storage space. Maximum is 1044464 bytes.
Global variables use 37372 bytes (45%) of dynamic memory, leaving 44548 bytes for local variables. Maximum is 81920 bytes.

UECIDE 0.9.1

• Error at line 231 in file Monitor.ino:
‣ expected '{' before ';' token

• Error at line 231 in file Monitor.ino:
‣ expected ')' before ';' token

• Error at line 190 in file Monitor.ino:
‣ redefinition of 'CronEntry cronBlink'

• Error at line 231 in file Monitor.ino:
‣ 'CronEntry cronBlink' previously declared here

Project is too large to post here, so I zipped it and uploaded to Google Drive, where anyone can download it with this link

https://drive.google.com/file/d/1BGvqtPx0547fPfX1Nucwhd_a-MO__vWX/view?usp=sharing

EDIT (After lambda comment by Majenko)

I was using a struct to hold cron entries, using lambdas:

struct CRON_ENTRY {
  boolean active;       // Task is active.
  unsigned long start;  // Start time (ms uptime).
  unsigned long repeat; // Repeat every (ms). 
  fcncron fcn;          // task.
};

CRON_ENTRY cronBlink = {false, 0,   500, [](CRON_ENTRY * c)
{
    digitalWrite(LED_BUILTIN, !digitalRead(LED_BUILTIN));
    display.countdownPanel();
}

and then replace CRON_ENTRY struct with CronEntry class:

CronEntry cronBlink(false, 0,   500, []() {
    digitalWrite(LED_BUILTIN, !digitalRead(LED_BUILTIN));
    display.countdownPanel();});

I really like lambas because they made code shorter.

  • ESP8266 support is shaky at best. They keep changing things randomly and breaking things. Time for yet another overhaul of the core... – Majenko Nov 16 '17 at 11:55
  • 1
    Actually, this is a problem with UECIDE itself - or rather with the INO parsing routine. You have a lambda function in a constructor, and it really doesn't like that (the CronEntry constructors). Consider moving those to normal functions instead. – Majenko Nov 16 '17 at 12:11
  • I need to rework the parser so it can handle lambda functions. I'll make it my top priority. It needs an overhaul anyway. – Majenko Nov 16 '17 at 12:19
  • Labdas are not something I have really worked with much. I prefer to keep my code in easy to manage blocks, and labdas confuse the hell outta me ;) – Majenko Nov 16 '17 at 12:47
  • UECIDE has a GitHub Issues page – Juraj Nov 16 '17 at 13:39
2

This is a bug in UECIDE. It doesn't like lambda functions in constructors.

A complete rewrite of the sketch parser to use Exuberant Ctags is under way.

| improve this answer | |
  • I thought that UECIDE and Arduino IDE have different front ends (UI) and the same back end (compiler and tools). Can you explain how they are different? – user31481 Nov 16 '17 at 22:38
  • There are three layers to both. The IDE (editor), the parser (which converts the INO into a CPP file) and the compiler. Only the compiler is the same. – Majenko Nov 16 '17 at 22:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy