Browse Source

Fix at90usb1286 build (#19687)

* Skip check for USBCON during dependency detection
* Ignore incompatible Teensy_ADC library, which requires Teensy >= 3
* Add IS_AT90USB

Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>
Jason Smith 4 years ago
parent
commit
8a5c3782b8

+ 2
- 2
Marlin/src/HAL/AVR/HAL.h View File

25
 #include "watchdog.h"
25
 #include "watchdog.h"
26
 #include "math.h"
26
 #include "math.h"
27
 
27
 
28
-#ifdef USBCON
28
+#ifdef IS_AT90USB
29
   #include <HardwareSerial.h>
29
   #include <HardwareSerial.h>
30
 #else
30
 #else
31
   #define HardwareSerial_h // Hack to prevent HardwareSerial.h header inclusion
31
   #define HardwareSerial_h // Hack to prevent HardwareSerial.h header inclusion
81
 //extern uint8_t MCUSR;
81
 //extern uint8_t MCUSR;
82
 
82
 
83
 // Serial ports
83
 // Serial ports
84
-#ifdef USBCON
84
+#ifdef IS_AT90USB
85
   #define MYSERIAL0 TERN(BLUETOOTH, bluetoothSerial, Serial)
85
   #define MYSERIAL0 TERN(BLUETOOTH, bluetoothSerial, Serial)
86
 #else
86
 #else
87
   #if !WITHIN(SERIAL_PORT, -1, 3)
87
   #if !WITHIN(SERIAL_PORT, -1, 3)

+ 3
- 3
Marlin/src/HAL/AVR/MarlinSerial.cpp View File

38
 
38
 
39
 #include "../../inc/MarlinConfig.h"
39
 #include "../../inc/MarlinConfig.h"
40
 
40
 
41
-#if !defined(USBCON) && (defined(UBRRH) || defined(UBRR0H) || defined(UBRR1H) || defined(UBRR2H) || defined(UBRR3H))
41
+#if !IS_AT90USB && (defined(UBRRH) || defined(UBRR0H) || defined(UBRR1H) || defined(UBRR2H) || defined(UBRR3H))
42
 
42
 
43
 #include "MarlinSerial.h"
43
 #include "MarlinSerial.h"
44
 #include "../../MarlinCore.h"
44
 #include "../../MarlinCore.h"
792
 
792
 
793
 #endif
793
 #endif
794
 
794
 
795
-#endif // !USBCON && (UBRRH || UBRR0H || UBRR1H || UBRR2H || UBRR3H)
795
+#endif // !IS_AT90USB && (UBRRH || UBRR0H || UBRR1H || UBRR2H || UBRR3H)
796
 
796
 
797
 // For AT90USB targets use the UART for BT interfacing
797
 // For AT90USB targets use the UART for BT interfacing
798
-#if defined(USBCON) && ENABLED(BLUETOOTH)
798
+#if BOTH(IS_AT90USB, BLUETOOTH)
799
   HardwareSerial bluetoothSerial;
799
   HardwareSerial bluetoothSerial;
800
 #endif
800
 #endif
801
 
801
 

+ 1
- 1
Marlin/src/HAL/AVR/MarlinSerial.h View File

327
 #endif
327
 #endif
328
 
328
 
329
 // Use the UART for Bluetooth in AT90USB configurations
329
 // Use the UART for Bluetooth in AT90USB configurations
330
-#if defined(USBCON) && ENABLED(BLUETOOTH)
330
+#if BOTH(IS_AT90USB, BLUETOOTH)
331
   extern HardwareSerial bluetoothSerial;
331
   extern HardwareSerial bluetoothSerial;
332
 #endif
332
 #endif

+ 1
- 2
Marlin/src/HAL/STM32F1/dogm/u8g_com_stm32duino_swspi.cpp View File

22
 
22
 
23
 #if BOTH(HAS_MARLINUI_U8GLIB, FORCE_SOFT_SPI)
23
 #if BOTH(HAS_MARLINUI_U8GLIB, FORCE_SOFT_SPI)
24
 
24
 
25
-#include "../HAL.h"
26
 #include <U8glib.h>
25
 #include <U8glib.h>
27
 
26
 
28
 #undef SPI_SPEED
27
 #undef SPI_SPEED
161
   return 1;
160
   return 1;
162
 }
161
 }
163
 
162
 
164
-#endif // HAS_MARLINUI_U8GLIB
163
+#endif // HAS_MARLINUI_U8GLIB && FORCE_SOFT_SPI
165
 #endif // STM32F1
164
 #endif // STM32F1

+ 2
- 2
Marlin/src/gcode/control/M111.cpp View File

55
   }
55
   }
56
   else {
56
   else {
57
     SERIAL_ECHOPGM(STR_DEBUG_OFF);
57
     SERIAL_ECHOPGM(STR_DEBUG_OFF);
58
-    #if !defined(__AVR__) || !defined(USBCON)
58
+    #if !IS_AT90USB
59
       #if ENABLED(SERIAL_STATS_RX_BUFFER_OVERRUNS)
59
       #if ENABLED(SERIAL_STATS_RX_BUFFER_OVERRUNS)
60
         SERIAL_ECHOPAIR("\nBuffer Overruns: ", MYSERIAL0.buffer_overruns());
60
         SERIAL_ECHOPAIR("\nBuffer Overruns: ", MYSERIAL0.buffer_overruns());
61
       #endif
61
       #endif
71
       #if ENABLED(SERIAL_STATS_MAX_RX_QUEUED)
71
       #if ENABLED(SERIAL_STATS_MAX_RX_QUEUED)
72
         SERIAL_ECHOPAIR("\nMax RX Queue Size: ", MYSERIAL0.rxMaxEnqueued());
72
         SERIAL_ECHOPAIR("\nMax RX Queue Size: ", MYSERIAL0.rxMaxEnqueued());
73
       #endif
73
       #endif
74
-    #endif //  !defined(__AVR__) || !defined(USBCON)
74
+    #endif // !IS_AT90USB
75
   }
75
   }
76
   SERIAL_EOL();
76
   SERIAL_EOL();
77
 }
77
 }

+ 1
- 1
Marlin/src/gcode/queue.cpp View File

624
         card.closefile();
624
         card.closefile();
625
         SERIAL_ECHOLNPGM(STR_FILE_SAVED);
625
         SERIAL_ECHOLNPGM(STR_FILE_SAVED);
626
 
626
 
627
-        #if !defined(__AVR__) || !defined(USBCON)
627
+        #if !IS_AT90USB
628
           #if ENABLED(SERIAL_STATS_DROPPED_RX)
628
           #if ENABLED(SERIAL_STATS_DROPPED_RX)
629
             SERIAL_ECHOLNPAIR("Dropped bytes: ", MYSERIAL0.dropped());
629
             SERIAL_ECHOLNPAIR("Dropped bytes: ", MYSERIAL0.dropped());
630
           #endif
630
           #endif

+ 4
- 4
Marlin/src/inc/Conditionals_adv.h View File

208
   #define NEEDS_HARDWARE_PWM 1
208
   #define NEEDS_HARDWARE_PWM 1
209
 #endif
209
 #endif
210
 
210
 
211
-#if !defined(__AVR__) || !defined(USBCON)
211
+#if defined(__AVR__) && defined(USBCON)
212
+  #define IS_AT90USB 1
213
+  #undef SERIAL_XON_XOFF // Not supported on USB-native devices
214
+#else
212
   // Define constants and variables for buffering serial data.
215
   // Define constants and variables for buffering serial data.
213
   // Use only 0 or powers of 2 greater than 1
216
   // Use only 0 or powers of 2 greater than 1
214
   // : [0, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, ...]
217
   // : [0, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, ...]
220
   #ifndef TX_BUFFER_SIZE
223
   #ifndef TX_BUFFER_SIZE
221
     #define TX_BUFFER_SIZE 32
224
     #define TX_BUFFER_SIZE 32
222
   #endif
225
   #endif
223
-#else
224
-  // SERIAL_XON_XOFF not supported on USB-native devices
225
-  #undef SERIAL_XON_XOFF
226
 #endif
226
 #endif
227
 
227
 
228
 #if ENABLED(HOST_ACTION_COMMANDS)
228
 #if ENABLED(HOST_ACTION_COMMANDS)

+ 3
- 3
Marlin/src/inc/SanityCheck.h View File

582
 /**
582
 /**
583
  * Serial
583
  * Serial
584
  */
584
  */
585
-#if !(defined(__AVR__) && defined(USBCON))
585
+#if !IS_AT90USB
586
   #if ENABLED(SERIAL_XON_XOFF) && RX_BUFFER_SIZE < 1024
586
   #if ENABLED(SERIAL_XON_XOFF) && RX_BUFFER_SIZE < 1024
587
     #error "SERIAL_XON_XOFF requires RX_BUFFER_SIZE >= 1024 for reliable transfers without drops."
587
     #error "SERIAL_XON_XOFF requires RX_BUFFER_SIZE >= 1024 for reliable transfers without drops."
588
   #elif RX_BUFFER_SIZE && (RX_BUFFER_SIZE < 2 || !IS_POWER_OF_2(RX_BUFFER_SIZE))
588
   #elif RX_BUFFER_SIZE && (RX_BUFFER_SIZE < 2 || !IS_POWER_OF_2(RX_BUFFER_SIZE))
2104
 #endif
2104
 #endif
2105
 
2105
 
2106
 /**
2106
 /**
2107
- * emergency-command parser
2107
+ * Emergency Command Parser
2108
  */
2108
  */
2109
-#if ENABLED(EMERGENCY_PARSER) && defined(__AVR__) && defined(USBCON)
2109
+#if BOTH(IS_AT90USB, EMERGENCY_PARSER)
2110
   #error "EMERGENCY_PARSER does not work on boards with AT90USB processors (USBCON)."
2110
   #error "EMERGENCY_PARSER does not work on boards with AT90USB processors (USBCON)."
2111
 #endif
2111
 #endif
2112
 
2112
 

+ 1
- 1
Marlin/src/pins/teensy2/pins_PRINTRBOARD_REVF.h View File

67
   #error "Oops! Select 'Teensy++ 2.0' or 'Printrboard' in 'Tools > Board.'"
67
   #error "Oops! Select 'Teensy++ 2.0' or 'Printrboard' in 'Tools > Board.'"
68
 #endif
68
 #endif
69
 
69
 
70
-#ifndef USBCON
70
+#if !defined(__MARLIN_DEPS__) && !defined(USBCON)
71
   #error "USBCON should be defined by the platform for this board."
71
   #error "USBCON should be defined by the platform for this board."
72
 #endif
72
 #endif
73
 
73
 

+ 1
- 0
platformio.ini View File

559
 platform      = teensy
559
 platform      = teensy
560
 extends       = common_avr8
560
 extends       = common_avr8
561
 board         = at90usb1286
561
 board         = at90usb1286
562
+lib_ignore    = ${env:common_avr8.lib_ignore} Teensy_ADC
562
 
563
 
563
 #
564
 #
564
 # AT90USB1286 boards using DFU bootloader
565
 # AT90USB1286 boards using DFU bootloader

Loading…
Cancel
Save