@@ -39,16 +39,20 @@ public Example(String fqn, IPath path) {
3939 myRequiredBoardAttributes .tone = examplesUsingTone ().contains (myFQN );
4040 myRequiredBoardAttributes .wire1 = examplesUsingWire1 ().contains (myFQN );
4141 myRequiredBoardAttributes .midi = examplesUsingMidi ().contains (myFQN ) || myFQN .contains ("USB_MIDI" );
42- myRequiredBoardAttributes .teensy = myFQN .startsWith ("Example/Teensy" );
42+ // myRequiredBoardAttributes.teensy = myFQN.startsWith("Example/Teensy");
4343 myRequiredBoardAttributes .worksOutOfTheBox = !failingExamples ().contains (myFQN );
44- myRequiredBoardAttributes .boardName = getRequiredBoardID (myFQN );
45- myRequiredBoardAttributes .mo_mcu = examplesUsingMCUmo ().contains (fqn );
44+ myRequiredBoardAttributes .boardID = getRequiredBoardID (myFQN );
45+ // myRequiredBoardAttributes.mo_mcu = examplesUsingMCUmo().contains(fqn);
4646 myRequiredBoardAttributes .rawHID = myFQN .contains ("USB_RawHID" );
4747 myRequiredBoardAttributes .buildInLed = myFQN .contains ("Blink" );
4848 myRequiredBoardAttributes .myNumAD = getNumADCUsedInExample (myFQN );
4949 myRequiredBoardAttributes .directMode = examplesUsingDirectMode ().contains (myFQN );
5050
51- myRequiredBoardAttributes = myRequiredBoardAttributes .or (Libraries .getRequiredBoardAttributes (getLibName ()));
51+ myRequiredBoardAttributes = myRequiredBoardAttributes .or (Libraries .getRequiredBoardAttributes (getLibFolder ()));
52+ }
53+
54+ private IPath getLibFolder () {//Need to remove the examples folder and the example folder
55+ return myPath .removeLastSegments (2 );
5256 }
5357
5458 private static int getNumADCUsedInExample (String myFQN2 ) {
@@ -237,12 +241,6 @@ private static LinkedList<String> examplesUsingWire1() {
237241 return ret ;
238242 }
239243
240- private static LinkedList <String > examplesUsingMCUmo () {
241- LinkedList <String > ret = new LinkedList <>();
242- ret .add ("Library/Adafruit_Circuit_Playground/CircuitPlaygroundFirmata_Express_CodeOrg" );
243- return ret ;
244- }
245-
246244 /*
247245 * These examples that are known to fail
248246 */
@@ -258,8 +256,8 @@ private static LinkedList<String> failingExamples() {
258256 // These examples are the processing part and are not a deal of sloeber
259257 ret .add ("Library/Adafruit_BNO055/bunny/processing/cuberotate" );
260258 // manual action is needed for following examples
259+ ret .add ("Library/AbsoluteMouse/DevKit" );
261260 ret .add ("Library/Accessories/CANCommander" );
262- ret .add ("Library/Accessories_CANCommander" );
263261 ret .add ("Library/Accessories/Demo" );
264262 ret .add ("Library/Accessories/Full" );
265263 ret .add ("Library/Accessories/Group" );
@@ -428,6 +426,8 @@ private static LinkedList<String> failingExamples() {
428426 ret .add ("Library/Blinker/Blinker_AUTO/AUTO_MQTT" );
429427 // 3: error: 'StaticJsonBuffer' was not declared in this scope
430428 ret .add ("Library/Boodskap_Message_library/SimpleMessageUsage" );
429+ //uses #include <ArduinoDebug.hpp>
430+ ret .add ("Library/107-Arduino-BoostUnits/Basic" );
431431 return ret ;
432432 }
433433
@@ -442,83 +442,90 @@ public static MCUBoard pickBestBoard(Example example, MCUBoard myBoards[]) {
442442 String libName = example .getLibName ();
443443 String fqn = example .getFQN ();
444444 if (myBoards .length == 0 ) {
445+ //No boards =>no match
446+ System .out .println ("No boards to select from found for " );
447+ return null ;
448+ }
449+ //examples using DHT_sensor_library libraries are not found as the include is
450+ // DHT.h
451+ if (!libName .equals ("DHT_sensor_library" ) && fqn .contains ("DHT" )) {
452+ System .out .println ("Ignore Lib as it is known to fail " + libName );
453+ return null ;
454+ }
455+ if (!example .getRequiredBoardAttributes ().worksOutOfTheBox ) {
456+ System .out .println ("Example is known to fail " + example .getFQN ());
445457 return null ;
446458 }
447459
448- if (example .getRequiredBoardAttributes ().worksOutOfTheBox ) {
460+ // if example states which board it wants use that board
461+ if (example .getRequiredBoardAttributes ().boardID != null ) {
462+ String wantedBoardName = example .getRequiredBoardAttributes ().boardID ;
463+ for (MCUBoard curBoard : myBoards ) {
464+ if (curBoard .getID ().equals (wantedBoardName )) {
465+ return curBoard ;
466+ }
467+ }
468+ System .out .println (
469+ "Example " + example .getFQN () + " requires board " + wantedBoardName + " that is not listed" );
470+ return null ;
471+ }
449472
450- // if example states which board it wants use that board
451- if (example .getRequiredBoardAttributes ().boardName != null ) {
452- String wantedBoardName = example .getRequiredBoardAttributes ().boardName ;
453- for (MCUBoard curBoard : myBoards ) {
454- if (curBoard .getID ().equals (wantedBoardName )) {
473+ // if the boardname is in the libname or ino name pick this one
474+ for (MCUBoard curBoard : myBoards ) {
475+ String curBoardName = curBoard .getName ();
476+ List <String > curBoardExampleNames = getSlangNames (curBoardName );
477+ for (String curBoardExampleName : curBoardExampleNames ) {
478+ if (libName .toLowerCase ().contains (curBoardName ) || fqn .toLowerCase ().contains (curBoardExampleName )) {
479+ if (curBoard .isExampleSupported (example )) {
455480 return curBoard ;
456481 }
457482 }
458- } else {
459- // examples using DHT_sensor_library libraries are not found as the include is
460- // DHT.h
461- if (!libName .equals ("DHT_sensor_library" ) && fqn .contains ("DHT" )) {
462- return null ;
463- }
464- // if the boardname is in the libname or ino name pick this one
465- for (MCUBoard curBoard : myBoards ) {
466- String curBoardName = curBoard .getName ();
467- List <String > curBoardExampleNames = getSlangNames (curBoardName );
468- for (String curBoardExampleName : curBoardExampleNames ) {
469- if (libName .toLowerCase ().contains (curBoardName )
470- || fqn .toLowerCase ().contains (curBoardExampleName )) {
471- if (curBoard .isExampleSupported (example )) {
472- return curBoard ;
473- }
474- }
475- }
476- }
477- // If the architecture is in the libname or boardname pick this one
478- for (MCUBoard curBoard : myBoards ) {
479- String curArchitectureName = curBoard .getBoardDescriptor ().getArchitecture ().toLowerCase ();
480- if (libName .toLowerCase ().contains (curArchitectureName )
481- || fqn .toLowerCase ().contains (curArchitectureName )) {
482- if (curBoard .isExampleSupported (example )) {
483- return curBoard ;
484- }
485- }
486- }
487- // if the example name contains teensy try teensy board
488- if (example .getFQN ().toLowerCase ().contains ("teensy" )) {
489- for (MCUBoard curBoard : myBoards ) {
490- if (Teensy .class .isInstance (curBoard )) {
491- return curBoard ;
492- }
493- }
483+ }
484+ }
485+ // If the architecture is in the libname or boardname pick this one
486+ for (MCUBoard curBoard : myBoards ) {
487+ String curArchitectureName = curBoard .getBoardDescriptor ().getArchitecture ().toLowerCase ();
488+ if (libName .toLowerCase ().contains (curArchitectureName )
489+ || fqn .toLowerCase ().contains (curArchitectureName )) {
490+ if (curBoard .isExampleSupported (example )) {
491+ return curBoard ;
494492 }
495- // if the example name contains ESP32 try ESP32 board
496- if ( example . getFQN (). toLowerCase (). contains ( "esp32" )) {
497- for ( MCUBoard curBoard : myBoards ) {
498- if (ESP32 . class . isInstance ( curBoard )) {
499- return curBoard ;
500- }
501- }
493+ }
494+ }
495+ // if the example name contains teensy try teensy board
496+ if (example . getFQN (). toLowerCase (). contains ( "teensy" )) {
497+ for ( MCUBoard curBoard : myBoards ) {
498+ if ( Teensy . class . isInstance ( curBoard )) {
499+ return curBoard ;
502500 }
503- // if the example name contains ESP try ESP8266 board
504- // if (example.getFQN().toLowerCase().contains("esp")) {
505- // for (MCUBoard curBoard : myBoards) {
506- // if (ESP8266.class.isInstance(curBoard)) {
507- // return curBoard;
508- // }
509- // }
510- // }
511- //causes issues with response
512-
513- // Out of guesses based on the name. Take the first ok one
514- for (MCUBoard curBoard : myBoards ) {
515- if (curBoard .isExampleSupported (example )) {
516- return curBoard ;
517- }
501+ }
502+ }
503+ // if the example name contains ESP32 try ESP32 board
504+ if (example .getFQN ().toLowerCase ().contains ("esp32" )) {
505+ for (MCUBoard curBoard : myBoards ) {
506+ if (ESP32 .class .isInstance (curBoard )) {
507+ return curBoard ;
518508 }
519509 }
520510 }
521- System .out .println ("No board found for " + Integer .toString (++noBoardFoundCount ) + " " + example .getFQN ());
511+ // if the example name contains ESP try ESP8266 board
512+ // if (example.getFQN().toLowerCase().contains("esp")) {
513+ // for (MCUBoard curBoard : myBoards) {
514+ // if (ESP8266.class.isInstance(curBoard)) {
515+ // return curBoard;
516+ // }
517+ // }
518+ // }
519+ //causes issues with response
520+
521+ // Out of guesses based on the name. Take the first ok one
522+ for (MCUBoard curBoard : myBoards ) {
523+ if (curBoard .isExampleSupported (example )) {
524+ return curBoard ;
525+ }
526+ }
527+ System .out .println (
528+ "No board found for " + Integer .toString (++noBoardFoundCount ) + " " + example .getPath ().toOSString ());
522529 return null ;
523530 }
524531
0 commit comments