dankeboy36 / esp-exception-decoder

ESP8266/ESP32 Exception Decoder Extension for the Arduino IDE
MIT License
62 stars 2 forks source link

No board selected (Please use the nightly IDE 2.x https://www.arduino.cc/en/software#nightly-builds) #10

Closed majodi closed 5 months ago

majodi commented 9 months ago

I get "No board selected" in red.

Screenshot 2023-09-19 at 20 17 58
birdoffire1549 commented 9 months ago

I too have this same issue. Using Arduino IDE:

Version: 2.2.1 Date: 2023-08-31T14:26:39.874Z (2 weeks ago) CLI Version: 0.34.0

dankeboy36 commented 9 months ago

https://github.com/dankeboy36/esp-exception-decoder/assets/111981763/88a4a8b1-1600-4cb7-839a-aefd1030d025

Thank you!

birdoffire1549 commented 9 months ago

@dankeboy36, The unsetting the board and port option and then re-selecting it has fixed the issue for me.

dankeboy36 commented 9 months ago

If somebody can reproduce it, please provide the logs. I will look into the defect. I will keep this issue open.

per1234 commented 9 months ago

The fault occurs when the board was selected on IDE startup:

To reproduce

  1. Select File > New Sketch from the Arduino IDE menus.
  2. Select a board from the Arduino IDE menus.
  3. Select File > Save As... from the Arduino IDE menus.
  4. Save the sketch to any convenient name and location. This step is performed in order to associate the board selection with a sketch that can be restored on IDE startup.
  5. Select File > Quit from the Arduino IDE menus.
  6. Start Arduino IDE. The saved sketches that were open during the previous session will be restored.
  7. Select the window of the sketch you saved during the previous steps.
  8. Run the "ESP Exception Decoder: Show Decoder Terminal" command. 🐛 The Exception Decoder view shows the message "No board selected" even though a board is in fact selected.
  9. Select any other board from the Arduino IDE menus.
  10. Select the target board once more. 🙂 The Exception Decoder now recognizes the board selection.

I am happy to provide logs, but I think you will be able to easily reproduce the fault now from the instructions I provided @dankeboy36 so they probably won't be needed.


I notice the fault occurs under the same conditions as https://github.com/arduino/arduino-ide/issues/2230#issuecomment-1728823010

majodi commented 9 months ago

Selecting another board and then the right board gave me "Sketch path is not set". Then after opening another sketch, close it and re-open the right sketch finally the exception decoder worked. So it seems that when the IDE is started with an existing project (sketch and board) it will not communicate the board/sketch to your code. I don't know (and don't have time to dive into it) if there is a way to force the IDE API to refresh and give you the current active board/sketch but that's what you need I guess.

kittaakos commented 9 months ago

This must be fixed in the IDE2 code. The problem is the same as https://github.com/arduino/arduino-ide/pull/2165#pullrequestreview-1568872036 and https://github.com/arduino/arduino-ide/pull/2165#pullrequestreview-1571165467. The Arduino state is set by IDE2 too early, and the board+port settings still need to be restored. Here is the overlooked TODO in the PR 🤦 This should fix:

diff --git a/arduino-ide-extension/src/browser/contributions/update-arduino-state.ts b/arduino-ide-extension/src/browser/contributions/update-arduino-state.ts
index 35b4c2ab..4e575430 100644
--- a/arduino-ide-extension/src/browser/contributions/update-arduino-state.ts
+++ b/arduino-ide-extension/src/browser/contributions/update-arduino-state.ts
@@ -76,7 +76,9 @@ export class UpdateArduinoState extends SketchContribution {
   }

   override onReady(): void {
-    this.updateBoardsConfig(this.boardsServiceProvider.boardsConfig); // TODO: verify!
+    this.boardsServiceProvider.ready.then(() => {
+      this.updateBoardsConfig(this.boardsServiceProvider.boardsConfig); // TODO: verify!
+    });
     this.updateSketchPath(this.sketchServiceClient.tryGetCurrentSketch());
     this.updateUserDirPath(this.configService.tryGetSketchDirUri());
     this.updateDataDirPath(this.configService.tryGetDataDirUri());
dankeboy36 commented 9 months ago

Please use the Arduino IDE 2.x nightly build with the fix: https://www.arduino.cc/en/software#nightly-builds