Bläddra i källkod

HAL cleanup, Teensy 3.1 platform

Scott Lahteine 4 år sedan
förälder
incheckning
e85eca2630

+ 1
- 0
.travis.yml Visa fil

@@ -14,6 +14,7 @@ env:
14 14
   - TEST_PLATFORM="LPC1768"
15 15
   - TEST_PLATFORM="LPC1769"
16 16
   - TEST_PLATFORM="STM32F1"
17
+  - TEST_PLATFORM="teensy31"
17 18
   - TEST_PLATFORM="teensy35"
18 19
   - TEST_PLATFORM="linux_native"
19 20
   - TEST_PLATFORM="esp32"

+ 0
- 1
Marlin/Configuration.h Visa fil

@@ -461,7 +461,6 @@
461 461
 #define PID_MAX BANG_MAX // Limits current to nozzle while PID is active (see PID_FUNCTIONAL_RANGE below); 255=full current
462 462
 #define PID_K1 0.95      // Smoothing factor within any PID loop
463 463
 #if ENABLED(PIDTEMP)
464
-  //#define MIN_POWER 0
465 464
   //#define PID_EDIT_MENU         // Add PID editing to the "Advanced Settings" menu. (~700 bytes of PROGMEM)
466 465
   //#define PID_AUTOTUNE_MENU     // Add PID auto-tuning to the "Advanced Settings" menu. (~250 bytes of PROGMEM)
467 466
   //#define PID_DEBUG             // Sends debug data to the serial port.

+ 1
- 1
Marlin/src/HAL/HAL_DUE/EepromEmulation_Due.cpp Visa fil

@@ -31,12 +31,12 @@
31 31
 
32 32
 #ifdef ARDUINO_ARCH_SAM
33 33
 
34
-#include "../shared/persistent_store_api.h"
35 34
 #include "../../inc/MarlinConfig.h"
36 35
 
37 36
 #if ENABLED(EEPROM_SETTINGS) && NONE(I2C_EEPROM, SPI_EEPROM)
38 37
 
39 38
 #include "../shared/Marduino.h"
39
+#include "../shared/persistent_store_api.h"
40 40
 
41 41
 #define EEPROMSize     4096
42 42
 #define PagesPerGroup   128

+ 3
- 5
Marlin/src/HAL/HAL_TEENSY31_32/HAL.h Visa fil

@@ -19,19 +19,17 @@
19 19
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
20 20
  *
21 21
  */
22
+#pragma once
22 23
 
23 24
 /**
24 25
  * Description: HAL for Teensy 3.5 and Teensy 3.6
25 26
  */
26 27
 
27
-#pragma once
28
-
29 28
 #define CPU_32_BIT
30 29
 
31 30
 #include "../shared/Marduino.h"
32
-
33
-#include "../math_32bit.h"
34
-#include "../HAL_SPI.h"
31
+#include "../shared/math_32bit.h"
32
+#include "../shared/HAL_SPI.h"
35 33
 
36 34
 #include "fastio_Teensy.h"
37 35
 #include "watchdog_Teensy.h"

+ 4
- 10
Marlin/src/HAL/HAL_TEENSY31_32/persistent_store_impl.cpp Visa fil

@@ -24,13 +24,10 @@
24 24
 
25 25
 #include "../shared/persistent_store_api.h"
26 26
 
27
-namespace HAL {
28
-namespace PersistentStore {
27
+bool PersistentStore::access_start() { return true; }
28
+bool PersistentStore::access_finish() { return true; }
29 29
 
30
-bool access_start() { return true; }
31
-bool access_finish() { return true; }
32
-
33
-bool write_data(int &pos, const uint8_t *value, uint16_t size, uint16_t *crc) {
30
+bool PersistentStore::write_data(int &pos, const uint8_t *value, uint16_t size, uint16_t *crc) {
34 31
   while (size--) {
35 32
     uint8_t * const p = (uint8_t * const)pos;
36 33
     uint8_t v = *value;
@@ -50,7 +47,7 @@ bool write_data(int &pos, const uint8_t *value, uint16_t size, uint16_t *crc) {
50 47
   return false;
51 48
 }
52 49
 
53
-bool read_data(int &pos, uint8_t* value, uint16_t size, uint16_t *crc, const bool writing/*=true*/) {
50
+bool PersistentStore::read_data(int &pos, uint8_t* value, uint16_t size, uint16_t *crc, const bool writing/*=true*/) {
54 51
   do {
55 52
     uint8_t c = eeprom_read_byte((uint8_t*)pos);
56 53
     if (writing) *value = c;
@@ -61,8 +58,5 @@ bool read_data(int &pos, uint8_t* value, uint16_t size, uint16_t *crc, const boo
61 58
   return false;
62 59
 }
63 60
 
64
-} // PersistentStore
65
-} // HAL
66
-
67 61
 #endif // EEPROM_SETTINGS
68 62
 #endif // __MK20DX256__

+ 0
- 50
Marlin/src/HAL/HAL_TEENSY35_36/persistent_store_impl.cpp Visa fil

@@ -1,50 +0,0 @@
1
-#if defined(__MK64FX512__) || defined(__MK66FX1M0__)
2
-
3
-#include "../../inc/MarlinConfig.h"
4
-
5
-#if ENABLED(EEPROM_SETTINGS)
6
-
7
-#include "../shared/persistent_store_api.h"
8
-
9
-namespace HAL {
10
-namespace PersistentStore {
11
-
12
-bool access_start() { return true; }
13
-bool access_finish() { return true; }
14
-
15
-bool write_data(int &pos, const uint8_t *value, uint16_t size, uint16_t *crc) {
16
-  while (size--) {
17
-    uint8_t * const p = (uint8_t * const)pos;
18
-    uint8_t v = *value;
19
-    // EEPROM has only ~100,000 write cycles,
20
-    // so only write bytes that have changed!
21
-    if (v != eeprom_read_byte(p)) {
22
-      eeprom_write_byte(p, v);
23
-      if (eeprom_read_byte(p) != v) {
24
-        SERIAL_ECHO_MSG(MSG_ERR_EEPROM_WRITE);
25
-        return true;
26
-      }
27
-    }
28
-    crc16(crc, &v, 1);
29
-    pos++;
30
-    value++;
31
-  };
32
-  return false;
33
-}
34
-
35
-bool read_data(int &pos, uint8_t* value, uint16_t size, uint16_t *crc, const bool writing/*=true*/) {
36
-  do {
37
-    uint8_t c = eeprom_read_byte((uint8_t*)pos);
38
-    if (writing) *value = c;
39
-    crc16(crc, &c, 1);
40
-    pos++;
41
-    value++;
42
-  } while (--size);
43
-  return false;
44
-}
45
-
46
-} // PersistentStore
47
-} // HAL
48
-
49
-#endif // EEPROM_SETTINGS
50
-#endif // __MK64FX512__ || __MK66FX1M0__

+ 1
- 4
Marlin/src/HAL/HAL_TEENSY35_36/pinsDebug.h Visa fil

@@ -16,8 +16,7 @@
16 16
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
17 17
  *
18 18
  */
19
-
20
-#ifndef HAL_PINSDEBUG_TEENSY_H
19
+#pragma once
21 20
 
22 21
 #define NUMBER_PINS_TOTAL NUM_DIGITAL_PINS
23 22
 #define MULTI_NAME_PAD 16 // space needed to be pretty if not first name assigned to a pin
@@ -103,5 +102,3 @@ bool HAL_pwm_status(int8_t pin) {
103 102
 }
104 103
 
105 104
 static void HAL_pwm_details(uint8_t pin) { /* TODO */ }
106
-
107
-#endif

Marlin/src/HAL/shared/I2cEeprom.cpp → Marlin/src/HAL/shared/eeprom_i2c.cpp Visa fil


Marlin/src/HAL/shared/SpiEeprom.cpp → Marlin/src/HAL/shared/eeprom_spi.cpp Visa fil


+ 7
- 7
Marlin/src/pins/stm32/pins_JGAURORA_A5S_A1.h Visa fil

@@ -39,13 +39,13 @@
39 39
 // #define MCU_STM32F103ZE // not yet required
40 40
 // Enable EEPROM Emulation for this board, so that we don't overwrite factory data
41 41
 
42
-// #define I2C_EEPROM   // AT24C64
43
-// #define E2END 0x7FFF // 64KB
44
-// #define FLASH_EEPROM_EMULATION 1
45
-// #define E2END 0xFFF // 4KB
46
-// #define E2END uint32(EEPROM_START_ADDRESS + (EEPROM_PAGE_SIZE * 2) - 1)
47
-// #define EEPROM_CHITCHAT
48
-// #define DEBUG_EEPROM_READWRITE
42
+//#define I2C_EEPROM   // AT24C64
43
+//#define E2END 0x7FFF // 64KB
44
+//#define FLASH_EEPROM_EMULATION
45
+//#define E2END 0xFFF // 4KB
46
+//#define E2END uint32(EEPROM_START_ADDRESS + (EEPROM_PAGE_SIZE * 2) - 1)
47
+//#define EEPROM_CHITCHAT
48
+//#define DEBUG_EEPROM_READWRITE
49 49
 
50 50
 //
51 51
 // Limit Switches

+ 116
- 0
buildroot/share/tests/teensy31-tests Visa fil

@@ -0,0 +1,116 @@
1
+#!/usr/bin/env bash
2
+#
3
+# Build tests for Teensy 3.1/3.2 (ARM Cortex-M4)
4
+#
5
+
6
+# exit on first failure
7
+set -e
8
+
9
+backup_ramps
10
+
11
+restore_configs
12
+opt_set MOTHERBOARD BOARD_TEENSY31_32
13
+exec_test $1 $2 "Teensy3.1 with default config"
14
+
15
+#
16
+# Test as many features together as possible
17
+#
18
+restore_configs
19
+opt_set MOTHERBOARD BOARD_TEENSY31_32
20
+opt_set EXTRUDERS 2
21
+opt_set TEMP_SENSOR_0 1
22
+opt_set TEMP_SENSOR_1 5
23
+opt_set TEMP_SENSOR_BED 1
24
+opt_enable REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER LCD_INFO_MENU SDSUPPORT SDCARD_SORT_ALPHA \
25
+           FILAMENT_WIDTH_SENSOR FILAMENT_LCD_DISPLAY CALIBRATION_GCODE BAUD_RATE_GCODE \
26
+           FIX_MOUNTED_PROBE Z_SAFE_HOMING AUTO_BED_LEVELING_BILINEAR Z_MIN_PROBE_REPEATABILITY_TEST DEBUG_LEVELING_FEATURE \
27
+           BABYSTEPPING BABYSTEP_XY BABYSTEP_ZPROBE_OFFSET BABYSTEP_ZPROBE_GFX_OVERLAY \
28
+           PRINTCOUNTER NOZZLE_PARK_FEATURE NOZZLE_CLEAN_FEATURE SLOW_PWM_HEATERS PIDTEMPBED EEPROM_SETTINGS INCH_MODE_SUPPORT TEMPERATURE_UNITS_SUPPORT M100_FREE_MEMORY_WATCHER \
29
+           ADVANCED_PAUSE_FEATURE ARC_SUPPORT BEZIER_CURVE_SUPPORT EXPERIMENTAL_I2CBUS EXTENDED_CAPABILITIES_REPORT AUTO_REPORT_TEMPERATURES PARK_HEAD_ON_PAUSE \
30
+           PHOTO_GCODE PHOTO_POSITION PHOTO_SWITCH_POSITION PHOTO_SWITCH_MS PHOTO_DELAY_MS PHOTO_RETRACT_MM \
31
+           HOST_ACTION_COMMANDS HOST_PROMPT_SUPPORT
32
+opt_set I2C_SLAVE_ADDRESS 63
33
+opt_set GRID_MAX_POINTS_X 16
34
+exec_test $1 $2 "Teensy3.1 with many features"
35
+
36
+#
37
+# Test a Sled Z Probe with Linear leveling
38
+#
39
+restore_configs
40
+opt_set MOTHERBOARD BOARD_TEENSY31_32
41
+opt_enable EEPROM_SETTINGS Z_PROBE_SLED AUTO_BED_LEVELING_LINEAR DEBUG_LEVELING_FEATURE GCODE_MACROS
42
+exec_test $1 $2 "Sled Z Probe with Linear leveling"
43
+
44
+#
45
+# Test a Servo Probe
46
+#
47
+# restore_configs
48
+# opt_set MOTHERBOARD BOARD_TEENSY31_32
49
+# opt_enable Z_PROBE_SERVO_NR Z_SERVO_ANGLES DEACTIVATE_SERVOS_AFTER_MOVE \
50
+#            AUTO_BED_LEVELING_3POINT DEBUG_LEVELING_FEATURE EEPROM_SETTINGS
51
+# opt_set NUM_SERVOS 1
52
+# exec_test $1 $2 "Servo Probe"
53
+#
54
+# ...with AUTO_BED_LEVELING_3POINT, DEBUG_LEVELING_FEATURE, EEPROM_SETTINGS, EEPROM_CHITCHAT, EXTENDED_CAPABILITIES_REPORT, and AUTO_REPORT_TEMPERATURES
55
+#
56
+# opt_enable AUTO_BED_LEVELING_3POINT DEBUG_LEVELING_FEATURE EEPROM_SETTINGS \
57
+#            EXTENDED_CAPABILITIES_REPORT AUTO_REPORT_TEMPERATURES
58
+# exec_test $1 $2 "...with AUTO_BED_LEVELING_3POINT, DEBUG_LEVELING_FEATURE, EEPROM_SETTINGS, EEPROM_CHITCHAT, EXTENDED_CAPABILITIES_REPORT, and AUTO_REPORT_TEMPERATURES"
59
+
60
+#
61
+# Test MAGNETIC_PARKING_EXTRUDER with LCD
62
+#
63
+restore_configs
64
+opt_set MOTHERBOARD BOARD_TEENSY31_32
65
+opt_set EXTRUDERS 2
66
+opt_set TEMP_SENSOR_1 1
67
+opt_enable MAGNETIC_PARKING_EXTRUDER ULTIMAKERCONTROLLER
68
+exec_test $1 $2 "MAGNETIC_PARKING_EXTRUDER with LCD"
69
+
70
+#
71
+# Mixing Extruder
72
+#
73
+restore_configs
74
+opt_set MOTHERBOARD BOARD_TEENSY31_32
75
+opt_enable MIXING_EXTRUDER DIRECT_MIXING_IN_G1 GRADIENT_MIX GRADIENT_VTOOL REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER
76
+opt_set MIXING_STEPPERS 2
77
+exec_test $1 $2 "Mixing Extruder"
78
+
79
+#
80
+# Test SWITCHING_EXTRUDER
81
+#
82
+# restore_configs
83
+# opt_set MOTHERBOARD BOARD_TEENSY31_32
84
+# opt_set EXTRUDERS 2
85
+# opt_set NUM_SERVOS 1
86
+# opt_enable SWITCHING_EXTRUDER ULTIMAKERCONTROLLER
87
+# exec_test $1 $2 "SWITCHING_EXTRUDER"
88
+#
89
+# Enable COREXY
90
+#
91
+restore_configs
92
+opt_set MOTHERBOARD BOARD_TEENSY31_32
93
+opt_enable COREXY
94
+exec_test $1 $2 "COREXY"
95
+
96
+#
97
+# Enable COREXZ
98
+#
99
+restore_configs
100
+opt_set MOTHERBOARD BOARD_TEENSY31_32
101
+opt_enable COREXZ
102
+exec_test $1 $2 "COREXZ"
103
+
104
+#
105
+# Enable Z_DUAL_STEPPER_DRIVERS, Z_DUAL_ENDSTOPS
106
+#
107
+restore_configs
108
+opt_set MOTHERBOARD BOARD_TEENSY31_32
109
+opt_enable Z_DUAL_STEPPER_DRIVERS Z_DUAL_ENDSTOPS
110
+pins_set ramps/RAMPS X_MAX_PIN -1
111
+opt_add Z2_MAX_PIN 2
112
+opt_enable USE_XMAX_PLUG
113
+exec_test $1 $2 "Z_DUAL_STEPPER_DRIVERS, Z_DUAL_ENDSTOPS"
114
+
115
+# Clean up
116
+restore_configs

+ 13
- 0
platformio.ini Visa fil

@@ -531,6 +531,19 @@ src_filter = ${common.default_src_filter} +<src/HAL/HAL_STM32>
531 531
 monitor_speed = 250000
532 532
 
533 533
 #
534
+# Teensy 3.1 / 3.2 (ARM Cortex-M4)
535
+#
536
+[env:teensy31]
537
+platform      = teensy
538
+framework     = arduino
539
+board         = teensy31
540
+build_flags   = ${common.build_flags}
541
+lib_deps      = ${common.lib_deps}
542
+lib_ignore    = Adafruit NeoPixel
543
+src_filter    = ${common.default_src_filter} +<src/HAL/HAL_TEENSY31_32>
544
+monitor_speed = 250000
545
+
546
+#
534 547
 # Teensy 3.5 / 3.6 (ARM Cortex-M4)
535 548
 #
536 549
 [env:teensy35]

Laddar…
Avbryt
Spara