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 3 years ago
parent
commit
8a5c3782b8

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

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

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

@@ -38,7 +38,7 @@
38 38
 
39 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 43
 #include "MarlinSerial.h"
44 44
 #include "../../MarlinCore.h"
@@ -792,10 +792,10 @@ MarlinSerial<MarlinSerialCfg<SERIAL_PORT>> customizedSerial1;
792 792
 
793 793
 #endif
794 794
 
795
-#endif // !USBCON && (UBRRH || UBRR0H || UBRR1H || UBRR2H || UBRR3H)
795
+#endif // !IS_AT90USB && (UBRRH || UBRR0H || UBRR1H || UBRR2H || UBRR3H)
796 796
 
797 797
 // For AT90USB targets use the UART for BT interfacing
798
-#if defined(USBCON) && ENABLED(BLUETOOTH)
798
+#if BOTH(IS_AT90USB, BLUETOOTH)
799 799
   HardwareSerial bluetoothSerial;
800 800
 #endif
801 801
 

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

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

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

@@ -22,7 +22,6 @@
22 22
 
23 23
 #if BOTH(HAS_MARLINUI_U8GLIB, FORCE_SOFT_SPI)
24 24
 
25
-#include "../HAL.h"
26 25
 #include <U8glib.h>
27 26
 
28 27
 #undef SPI_SPEED
@@ -161,5 +160,5 @@ uint8_t u8g_com_HAL_STM32F1_sw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val,
161 160
   return 1;
162 161
 }
163 162
 
164
-#endif // HAS_MARLINUI_U8GLIB
163
+#endif // HAS_MARLINUI_U8GLIB && FORCE_SOFT_SPI
165 164
 #endif // STM32F1

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

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

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

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

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

@@ -208,7 +208,10 @@
208 208
   #define NEEDS_HARDWARE_PWM 1
209 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 215
   // Define constants and variables for buffering serial data.
213 216
   // Use only 0 or powers of 2 greater than 1
214 217
   // : [0, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, ...]
@@ -220,9 +223,6 @@
220 223
   #ifndef TX_BUFFER_SIZE
221 224
     #define TX_BUFFER_SIZE 32
222 225
   #endif
223
-#else
224
-  // SERIAL_XON_XOFF not supported on USB-native devices
225
-  #undef SERIAL_XON_XOFF
226 226
 #endif
227 227
 
228 228
 #if ENABLED(HOST_ACTION_COMMANDS)

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

@@ -582,7 +582,7 @@
582 582
 /**
583 583
  * Serial
584 584
  */
585
-#if !(defined(__AVR__) && defined(USBCON))
585
+#if !IS_AT90USB
586 586
   #if ENABLED(SERIAL_XON_XOFF) && RX_BUFFER_SIZE < 1024
587 587
     #error "SERIAL_XON_XOFF requires RX_BUFFER_SIZE >= 1024 for reliable transfers without drops."
588 588
   #elif RX_BUFFER_SIZE && (RX_BUFFER_SIZE < 2 || !IS_POWER_OF_2(RX_BUFFER_SIZE))
@@ -2104,9 +2104,9 @@ static_assert(hbm[Z_AXIS] >= 0, "HOMING_BUMP_MM.Z must be greater than or equal
2104 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 2110
   #error "EMERGENCY_PARSER does not work on boards with AT90USB processors (USBCON)."
2111 2111
 #endif
2112 2112
 

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

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

+ 1
- 0
platformio.ini View File

@@ -559,6 +559,7 @@ build_unflags = -g -ggdb
559 559
 platform      = teensy
560 560
 extends       = common_avr8
561 561
 board         = at90usb1286
562
+lib_ignore    = ${env:common_avr8.lib_ignore} Teensy_ADC
562 563
 
563 564
 #
564 565
 # AT90USB1286 boards using DFU bootloader

Loading…
Cancel
Save