Go Down

Topic: IDE 1.8.0 Released -- update: 1.8.9 (Read 126952 times) previous topic - next topic

pert

I downloaded the new version but suddenly "  while (Serial.available()==0){ } " stopped working so I uninstalled and kept working on the older version if someone can help it would be so thankful
Which version is the older version?

pert

I downloaded the new version but suddenly "  while (Serial.available()==0){ } " stopped working so I uninstalled and kept working on the older version if someone can help it would be so thankful
We'll resolve this issue here:
http://forum.arduino.cc/index.php?topic=591792

GalFisk

I can't add a label as the very last item in the main loop.

This works:
Code: [Select]
void loop() {
  // put your main code here, to run repeatedly:
label:
delay(1);
}

This doesn't:
Code: [Select]
void loop() {
  // put your main code here, to run repeatedly:
label:
}

The error message is:

Quote
exit status 1
expected primary-expression before '}' token
I wanted to use goto (yeah, I know goto is considered harmful) in order to break out of a deeply nested loop and go to the very end of the sketch, where nothing more should be done.


Another thing: if I enable code folding, fold a function with an error inside it, and compile, the IDE will mark the very top line of the sketch as erroneous (in pink) rather than the actual line with the error.
I wish that it would either mark the first line of the function itself, or automatically unfold the function and then mark the correct line. As it is now I have to hunt for the broken function.

A related question: is there a shortcut to fold or unfold all code at the same time?

nitrof

a label should have some code after it. if you want to leave the loop, just return it:

Code: [Select]

void loop() {
  if(something) {
  return;
}
somethingElse(); // somethingElse will not be call if something is true


Also, dont know your code, but you should try reverse condition check to avoid deep if nesting using return statement.

Code: [Select]
void myFunction() {

  if (contiotion1) {
    if (condition2) {
      doSomething();
    }
  }
}



could be:

Code: [Select]
void myFunction() {

  if (!contiotion1) {
    return;
  }
  if (!condition2) {
    return;
  }
  doSomething();
}




Finally, you should have start another tread in the forum instead...

regards. Nitrof

pert

I wanted to use goto (yeah, I know goto is considered harmful) in order to break out of a deeply nested loop and go to the very end of the sketch, where nothing more should be done.
Are you aware that once you reach the end of the loop function, it will just run the loop over again? If you really do want to do nothing more ever, you can use this line of code:
Code: [Select]
while(true) {}  // endless loop that does nothing

Another thing: if I enable code folding, fold a function with an error inside it, and compile, the IDE will mark the very top line of the sketch as erroneous (in pink) rather than the actual line with the error.
I wish that it would either mark the first line of the function itself, or automatically unfold the function and then mark the correct line. As it is now I have to hunt for the broken function.
I have reported this to the Arduino developers:
https://github.com/arduino/Arduino/issues/8457
Thanks for letting us know of the issue.

A related question: is there a shortcut to fold or unfold all code at the same time?
Not that I know of (I'd be interested to hear if there is one). You can fold or unfold all via Right Click > Folding > Collapse/Expand All Folds

GalFisk

I'm new and I've only used 1.8.8. I thought the issue was bug in the IDE, since the sample code in the Arduino reference (https://www.arduino.cc/reference/en/language/structure/control-structure/goto/) shows an example that ends with a label, and says nothing about the limitations.
I guess the reference could do with a slight update instead.

Sorry if I wasn't clear: I don't need the Arduino to halt, I just didn't need to put any more code after the label, and thought that it was odd that it then failed.

The actual code is a bunch of for loops that create different counters used to coordinate different parts of an old LCD. At the center of it all, the content of an array is being output to the LCD, and there is a condition to goto the outside of everything whenever the array is exhausted.

I don't have the current code here, but here is a simpler version of what I tried to write.

Code: [Select]
void loop() {
  // put your main code here, to run repeatedly:
  int counter=0;
  for (byte c=0; c<10; c++) {   // Cycle chips
    LCD1.chipSelect(1 << c);
    for (byte b=0; b<4; b++)  {   // Cycle banks
      LCD1.setBank(b);
      for (byte a=0; a<50; a++) {   // Cycle address
        LCD1.writeData(font[counter]);
        counter++;
        if (counter>sizeof(font)) goto quit;
      }
    }
  }
quit:
}

nitrof

Code: [Select]
if (counter>sizeof(font)) return; that's it...

GalFisk

Code: [Select]
if (counter>sizeof(font)) return;
 that's it...
Nice, thanks.

Another issue: if my computer has been up for a few days with the IDE always running, in and out of sleep mode (S1 suspend only, no S3) I'll start to get random, intermittent compile errors, the error message indicating a segfault in the compiler (apologies for not having the actual error message at hand). A compilation can work fine just to fail during the next attempt, fail consistently, or fail according to changes in the code (the first time this happened, it failed whenever I used a 0xsomething or 0bsomething literal, but decimal worked fine - until it suddenly started failing at everything).
Is this a known issue, and if not, how can I best report it?

pert

the error message indicating a segfault in the compiler
I can't say for certain without seeing the actual error output, but I suspect it's this:

This bug is specific to the 5.4.0-atmel3.6.1-arduino2 version of avr-gcc used by Arduino AVR Boards 1.6.22 and newer. It has been reported here:
https://github.com/arduino/Arduino/issues/7949

Here's the traditional workaround:
  • Tools > Board > Boards Manager
  • Wait for downloads to finish.
  • When you move the mouse pointer over "Arduino AVR Boards", you will see a "Select version" dropdown menu appear. Select "1.6.21".
  • Click "Install".
  • Wait for installation to finish.
  • Click "Close".

Due to a bug, this workaround doesn't work with Arduino IDE 1.8.6, but it will work with any other version of the Arduino IDE.

If you have File > Preferences > Check for updates on startup checked, the Arduino IDE may occasionally notify you that a new version of Arduino AVR Boards is available, you'll need to refrain from updating back to the new Arduino AVR Boards version, otherwise you'll be back to seeing the segmentation fault error again.


Alternate workaround:
One of the Arduino developers recently worked on this and claims to have fixed it. There is a special beta testing hardware package you can install via the Arduino IDE's Boards Manager that has the fix:
  • (In the Arduino IDE) File > Preferences
  • In the "Additional Boards Manager URLs" field, enter: http://downloads.arduino.cc/packages/package_avr_7.3.0_index.json If you already have an additional Boards Manager URL in that field, you can separate multiple URLs with commas or click the button on the right side of the field to open a dialog that allows you to add each on its own line.
  • Click "OK"
  • Tools > Board > Boards Manager
  • Wait for the downloads to finish
  • Click on "Arduino AVR Boards by Arduino"
  • Click the "Update" button.
  • Wait for the update to finish.
  • Click "Close".

pert

how can I best report it?
As you can see, this particular issue has already been thoroughly reported and addressed. However, you seem to be very good at spotting issues and willing to make the effort to report them so that we can improve the Arduino project. I do try to transfer issues reported on the forum to the places where the Arduino developers will see them, but I only do this when I can reproduce the issue so it's best when the original user reports it to them directly. Here, you will find a guide with links to where any given issue topic should be reported, as well as what the required information is:
https://github.com/arduino/Arduino/blob/4c9da50e57030aebd4320fcc24e3f497f504b663/CONTRIBUTING.md

The most important points:
  • If it's a software problem, make sure the problem still occurs using the latest version. In the case of the Arduino IDE, this means you need to download and test with a fresh copy of the Hourly Build.
  • Do a search of the relevant issue tracker to make sure the issue hasn't already been reported.


You can make a very significant contribution to the Arduino project by submitting high quality issue reports.

BTW, I do have it on my "to do" list to investigate the goto reference page example code issue you reported in a previous reply.

GalFisk

Thanks for the links and info. I'll test the newest build, and continue to report issues to what I think are the correct channels (even if I don't always get it right the first time). I enjoy bug hunting though I don't have the deepest of knowledge, and I'm always happy to help in the ways I can.

Geek Emeritus

#251
Feb 02, 2019, 02:41 am Last Edit: Feb 02, 2019, 05:13 am by Geek Emeritus
it took two days and a dozen tries to get it installed on Ubuntu. now that I have 1.8.5 installed, it fails to compile on the first line of every sketch. it invariably can not find the #include<whatever.h> files.

installed at:

path=/home/username/Arduino

sketchbook path=/home/username/Arduino

libraries at

home/username/Arduino/libraries

and

home/username/arduino/libraries

and

home/username/sketchbook/libraries

and it can't find the libraries in programs that work just fine in 1.05

// spoke too soon. you just put the libraries in

home/username/snap/arduino-mhall119/current/Arduino/libraries

how could I miss something so intuitive?
All PMs will be deleted unopened due to arrogant argumentative pot stirring Malfoys.
 If you have not read "How to use this forum - please read", in particular: "7. If you are posting code or error messages, use "code" tags":  expect rude responses

pert

// spoke too soon. you just put the libraries in

home/username/snap/arduino-mhall119/current/Arduino/libraries

how could I miss something so intuitive?
That's actually a very bad idea. The reason is that anything you put in the Arduino IDE installation folder (home/username/snap/arduino-mhall119/current/Arduino in this case) will be lost every time you update to a new version of the Arduino IDE. This is why you should always install libraries to the libraries subfolder of the sketchbook folder, which persists through updates.

More information:
https://www.arduino.cc/en/guide/libraries

For your information, the "mhall119" Snap package is an outdated and unofficial 3rd party project which may have been modified in unspecified ways. I recommend always getting the official Arduino IDE from:
http://www.arduino.cc/en/Main/Software

Danna_Meca

He instalado arduino 1.8 (exe) en Windows 7, pero no puedo acceder al submenú Puertos. Tengo un Arduino M0 Pro instalado y la conexión USB lo verifica (dice en el Administrador de dispositivos, Dispositivos USB: Arduino M0 Pro), pero no tiene un número COM. Por favor aviseme : smiley-triste:

GuitarPhil

I downloaded the new version but suddenly "  while (Serial.available()==0){ } " stopped working so I uninstalled and kept working on the older version if someone can help it would be so thankful
I'm also having problems with serial communication between my Arduino code and a Processing app on my PC (Windows 10).

Code that was compiled with an earlier IDE (I think it was 1.6.5) works but now when I re-compile exactly the same source code with 1.8.7 I get random errors in the data sent from the PC to the Arduino.

How was the built-in Serial code changed for Version 1.8x, as I assume it must be behaving differently from how it did in the earlier IDE versions which produce 100% working code for my project.?

Go Up