Sfoglia il codice sorgente

Clean up HAL trailing spaces, MKS SBASE pins

Scott Lahteine 7 anni fa
parent
commit
90a14b4f5b

+ 70
- 56
Marlin/src/HAL/HAL_LPC1768/persistent_store_impl.cpp Vedi File

@@ -1,3 +1,24 @@
1
+/**
2
+ * Marlin 3D Printer Firmware
3
+ * Copyright (C) 2016, 2017 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
4
+ *
5
+ * Based on Sprinter and grbl.
6
+ * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
7
+ *
8
+ * This program is free software: you can redistribute it and/or modify
9
+ * it under the terms of the GNU General Public License as published by
10
+ * the Free Software Foundation, either version 3 of the License, or
11
+ * (at your option) any later version.
12
+ *
13
+ * This program is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
+ * GNU General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU General Public License
19
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
20
+ *
21
+ */
1 22
 #ifdef TARGET_LPC1768
2 23
 
3 24
 #include "../../inc/MarlinConfig.h"
@@ -19,8 +40,6 @@ FATFS fat_fs;
19 40
 FIL eeprom_file;
20 41
 
21 42
 bool access_start() {
22
-  UINT file_size = 0,
23
-       bytes_written = 0;
24 43
   const char eeprom_erase_value = 0xFF;
25 44
   MSC_Aquire_Lock();
26 45
   if (f_mount(&fat_fs, "", 1)) {
@@ -30,9 +49,8 @@ bool access_start() {
30 49
   FRESULT res = f_open(&eeprom_file, "eeprom.dat", FA_OPEN_ALWAYS | FA_WRITE | FA_READ);
31 50
   if (res) MSC_Release_Lock();
32 51
 
33
-  if (res == FR_OK) file_size = f_size(&eeprom_file);
34
-
35 52
   if (res == FR_OK) {
53
+    uint16_t bytes_written, file_size = f_size(&eeprom_file);
36 54
     f_lseek(&eeprom_file, file_size);
37 55
     while (file_size <= E2END && res == FR_OK) {
38 56
       res = f_write(&eeprom_file, &eeprom_erase_value, 1, &bytes_written);
@@ -56,53 +74,52 @@ bool access_finish() {
56 74
 // File function return codes for type FRESULT   This goes away soon.   But it is helpful right now to see
57 75
 // the different errors the read_data() and write_data() functions are seeing.
58 76
 //
59
-//typedef enum {
60
-//      FR_OK = 0,               /* (0) Succeeded */
61
-//      FR_DISK_ERR,             /* (1) A hard error occurred in the low level disk I/O layer */
62
-//      FR_INT_ERR,              /* (2) Assertion failed */
63
-//      FR_NOT_READY,            /* (3) The physical drive cannot work */
64
-//      FR_NO_FILE,              /* (4) Could not find the file */
65
-//      FR_NO_PATH,              /* (5) Could not find the path */
66
-//      FR_INVALID_NAME,         /* (6) The path name format is invalid */
67
-//      FR_DENIED,               /* (7) Access denied due to prohibited access or directory full */
68
-//      FR_EXIST,                /* (8) Access denied due to prohibited access */
69
-//      FR_INVALID_OBJECT,       /* (9) The file/directory object is invalid */
70
-//      FR_WRITE_PROTECTED,      /* (10) The physical drive is write protected */
71
-//      FR_INVALID_DRIVE,        /* (11) The logical drive number is invalid */
72
-//      FR_NOT_ENABLED,          /* (12) The volume has no work area */
73
-//      FR_NO_FILESYSTEM,        /* (13) There is no valid FAT volume */
74
-//      FR_MKFS_ABORTED,         /* (14) The f_mkfs() aborted due to any problem */
75
-//      FR_TIMEOUT,              /* (15) Could not get a grant to access the volume within defined period */
76
-//      FR_LOCKED,               /* (16) The operation is rejected according to the file sharing policy */
77
-//      FR_NOT_ENOUGH_CORE,      /* (17) LFN working buffer could not be allocated */
78
-//      FR_TOO_MANY_OPEN_FILES,  /* (18) Number of open files > FF_FS_LOCK */
79
-//      FR_INVALID_PARAMETER     /* (19) Given parameter is invalid */
80
-//} FRESULT;
77
+//  typedef enum {
78
+//    FR_OK = 0,               /* (0) Succeeded */
79
+//    FR_DISK_ERR,             /* (1) A hard error occurred in the low level disk I/O layer */
80
+//    FR_INT_ERR,              /* (2) Assertion failed */
81
+//    FR_NOT_READY,            /* (3) The physical drive cannot work */
82
+//    FR_NO_FILE,              /* (4) Could not find the file */
83
+//    FR_NO_PATH,              /* (5) Could not find the path */
84
+//    FR_INVALID_NAME,         /* (6) The path name format is invalid */
85
+//    FR_DENIED,               /* (7) Access denied due to prohibited access or directory full */
86
+//    FR_EXIST,                /* (8) Access denied due to prohibited access */
87
+//    FR_INVALID_OBJECT,       /* (9) The file/directory object is invalid */
88
+//    FR_WRITE_PROTECTED,      /* (10) The physical drive is write protected */
89
+//    FR_INVALID_DRIVE,        /* (11) The logical drive number is invalid */
90
+//    FR_NOT_ENABLED,          /* (12) The volume has no work area */
91
+//    FR_NO_FILESYSTEM,        /* (13) There is no valid FAT volume */
92
+//    FR_MKFS_ABORTED,         /* (14) The f_mkfs() aborted due to any problem */
93
+//    FR_TIMEOUT,              /* (15) Could not get a grant to access the volume within defined period */
94
+//    FR_LOCKED,               /* (16) The operation is rejected according to the file sharing policy */
95
+//    FR_NOT_ENOUGH_CORE,      /* (17) LFN working buffer could not be allocated */
96
+//    FR_TOO_MANY_OPEN_FILES,  /* (18) Number of open files > FF_FS_LOCK */
97
+//    FR_INVALID_PARAMETER     /* (19) Given parameter is invalid */
98
+//  } FRESULT;
81 99
 
82 100
 bool write_data(int &pos, const uint8_t *value, uint16_t size, uint16_t *crc) {
83 101
   FRESULT s;
84
-  UINT bytes_written = 0;
102
+  uint16_t bytes_written = 0;
103
+
85 104
   s = f_lseek(&eeprom_file, pos);
86
-  if ( s ) {
105
+  if (s) {
87 106
    SERIAL_PROTOCOLPAIR(" write_data(", pos);         // This extra chit-chat goes away soon.  But it is helpful
88
-   SERIAL_PROTOCOLPAIR(",", (int) value);            // right now to see errors that are happening in the 
89
-   SERIAL_PROTOCOLPAIR(",", (int) size);             // read_data() and write_data() functions
107
+   SERIAL_PROTOCOLPAIR(",", (int)value);            // right now to see errors that are happening in the
108
+   SERIAL_PROTOCOLPAIR(",", (int)size);             // read_data() and write_data() functions
90 109
    SERIAL_PROTOCOL("...)\n");
91
-   SERIAL_PROTOCOLPAIR(" f_lseek()=", (int) s);
92
-   SERIAL_PROTOCOL("\n");
110
+   SERIAL_PROTOCOLLNPAIR(" f_lseek()=", (int)s);
93 111
    return s;
94 112
   }
113
+
95 114
   s = f_write(&eeprom_file, (void *)value, size, &bytes_written);
96
-  if ( s ) {
115
+  if (s) {
97 116
    SERIAL_PROTOCOLPAIR(" write_data(", pos);         // This extra chit-chat goes away soon.  But it is helpful
98
-   SERIAL_PROTOCOLPAIR(",", (int) value);            // right now to see errors that are happening in the 
99
-   SERIAL_PROTOCOLPAIR(",", (int) size);             // read_data() and write_data() functions
100
-   SERIAL_PROTOCOL("...)\n");
101
-   SERIAL_PROTOCOLPAIR(" f_write()=", (int) s);
102
-   SERIAL_PROTOCOL("\n");
103
-   SERIAL_PROTOCOLPAIR(" size=",  (int) size);
104
-   SERIAL_PROTOCOLPAIR("\n bytes_written=",  (int) bytes_written);
105
-   SERIAL_PROTOCOL("\n");
117
+   SERIAL_PROTOCOLPAIR(",", (int)value);            // right now to see errors that are happening in the
118
+   SERIAL_PROTOCOLPAIR(",", size);             // read_data() and write_data() functions
119
+   SERIAL_PROTOCOLLN("...)");
120
+   SERIAL_PROTOCOLLNPAIR(" f_write()=", (int)s);
121
+   SERIAL_PROTOCOLPAIR(" size=", size);
122
+   SERIAL_PROTOCOLLNPAIR("\n bytes_written=", bytes_written);
106 123
    return s;
107 124
   }
108 125
   crc16(crc, value, size);
@@ -111,29 +128,26 @@ bool write_data(int &pos, const uint8_t *value, uint16_t size, uint16_t *crc) {
111 128
 }
112 129
 
113 130
 bool read_data(int &pos, uint8_t* value, uint16_t size, uint16_t *crc) {
114
-  UINT bytes_read = 0;
131
+  uint16_t bytes_read = 0;
115 132
   FRESULT s;
116 133
   s = f_lseek(&eeprom_file, pos);
117 134
   if ( s ) {
118 135
    SERIAL_PROTOCOLPAIR(" read_data(", pos);          // This extra chit-chat goes away soon.  But it is helpful
119
-   SERIAL_PROTOCOLPAIR(",", (int) value);            // right now to see errors that are happening in the 
120
-   SERIAL_PROTOCOLPAIR(",", (int) size);             // read_data() and write_data() functions
121
-   SERIAL_PROTOCOL("...)\n");
122
-   SERIAL_PROTOCOLPAIR(" f_lseek()=", (int) s);
123
-   SERIAL_PROTOCOL("\n");
136
+   SERIAL_PROTOCOLPAIR(",", (int)value);            // right now to see errors that are happening in the
137
+   SERIAL_PROTOCOLPAIR(",", size);             // read_data() and write_data() functions
138
+   SERIAL_PROTOCOLLN("...)");
139
+   SERIAL_PROTOCOLLNPAIR(" f_lseek()=", (int)s);
124 140
    return true;
125 141
   }
126 142
   s = f_read(&eeprom_file, (void *)value, size, &bytes_read);
127
-  if ( s ) {
143
+  if (s) {
128 144
    SERIAL_PROTOCOLPAIR(" read_data(", pos);         // This extra chit-chat goes away soon.  But it is helpful
129
-   SERIAL_PROTOCOLPAIR(",", (int) value);           // right now to see errors that are happening in the 
130
-   SERIAL_PROTOCOLPAIR(",", (int) size);            // read_data() and write_data() functions
131
-   SERIAL_PROTOCOL("...)\n");
132
-   SERIAL_PROTOCOLPAIR(" f_write()=", (int) s);
133
-   SERIAL_PROTOCOL("\n");
134
-   SERIAL_PROTOCOLPAIR(" size=",  (int) size);
135
-   SERIAL_PROTOCOLPAIR("\n bytes_read=",  (int) bytes_read);
136
-   SERIAL_PROTOCOL("\n");
145
+   SERIAL_PROTOCOLPAIR(",", (int)value);           // right now to see errors that are happening in the
146
+   SERIAL_PROTOCOLPAIR(",", size);            // read_data() and write_data() functions
147
+   SERIAL_PROTOCOLLN("...)");
148
+   SERIAL_PROTOCOLLNPAIR(" f_write()=", (int)s);
149
+   SERIAL_PROTOCOLPAIR(" size=", size);
150
+   SERIAL_PROTOCOLLNPAIR("\n bytes_read=",  bytes_read);
137 151
    return true;
138 152
   }
139 153
   crc16(crc, value, size);

+ 1
- 1
Marlin/src/HAL/HAL_LPC1768/pinmap_re_arm.h Vedi File

@@ -220,7 +220,7 @@ const pin_data pin_map[] = { // pin map for variable pin function
220 220
   {1,4},        //  DIO77                   J12-10            ENET_TX_EN
221 221
   {1,0},        //  DIO78                   J12-11            ENET_TXD0
222 222
   {1,1},        //  DIO79                   J12-12            ENET_TXD1
223
-  {0,14},       //  DIO80                   MKS-SBASE	J7-6 & EXP1-5	  
223
+  {0,14},       //  DIO80                   MKS-SBASE	J7-6 & EXP1-5
224 224
   {0,7},        //  DIO81  SD-SCK           MKS-SBASE	on board SD card and EXP2-2
225 225
   {0,8},        //  DIO82  SD-MISO          MKS-SBASE	on board SD card and EXP2-1
226 226
   {0,9},        //  DIO83  SD-MOSI          MKS-SBASE 	n board SD card and EXP2-6

+ 1
- 1
Marlin/src/config/examples/Mks/Sbase/Configuration.h Vedi File

@@ -1255,7 +1255,7 @@
1255 1255
  * Enable one of the following items for a slower SPI transfer speed.
1256 1256
  * This may be required to resolve "volume init" errors or LCD issues.
1257 1257
  */
1258
- 
1258
+
1259 1259
 //#define SPI_SPEED SPI_HALF_SPEED
1260 1260
 //#define SPI_SPEED SPI_QUARTER_SPEED
1261 1261
 //#define SPI_SPEED SPI_EIGHTH_SPEED

+ 43
- 91
Marlin/src/pins/pins_MKS_SBASE.h Vedi File

@@ -43,12 +43,6 @@
43 43
 #define D58               58
44 44
 */
45 45
 
46
-
47
-//
48
-// Servos
49
-//
50
-
51
-    
52 46
 //
53 47
 // Limit Switches
54 48
 //
@@ -59,8 +53,6 @@
59 53
 #define Z_MIN_PIN          19  //The original Mks Sbase DIO19 has a 10k pullup to 3.3V or 5V, 1K series, so when using a Zprobe we must use DIO41 (J8 P1.22)
60 54
 #define Z_MAX_PIN          18  //10k pullup to 3.3V, 1K series
61 55
 
62
-
63
-
64 56
 //
65 57
 // Steppers
66 58
 //
@@ -84,35 +76,32 @@
84 76
 #define E1_DIR_PIN         34
85 77
 #define E1_ENABLE_PIN      30
86 78
 
87
-
88 79
 #define X2_STEP_PIN        36
89 80
 #define X2_DIR_PIN         34
90 81
 #define X2_ENABLE_PIN      30
91 82
 
92
-
93 83
 //
94 84
 // Temperature Sensors
95
-//  3.3V max when defined as an analog input
85
+// 3.3V max when defined as an analog input
96 86
 //
97 87
 
98
-
99
-#define TEMP_0_PIN          0  //A0 (TH1)
100
-#define TEMP_BED_PIN        1  //A1 (TH2)
101
-#define TEMP_1_PIN          2  //A2 (TH3)
102
-#define TEMP_2_PIN          3  //A3 (TH4)
88
+#define TEMP_0_PIN          0  // A0 (TH1)
89
+#define TEMP_BED_PIN        1  // A1 (TH2)
90
+#define TEMP_1_PIN          2  // A2 (TH3)
91
+#define TEMP_2_PIN          3  // A3 (TH4)
103 92
 
104 93
 
105 94
 //
106 95
 // Heaters / Fans
107 96
 //
108 97
 
109
-#define HEATER_BED_PIN      10
98
+#define HEATER_BED_PIN     10
110 99
 #define HEATER_0_PIN        8
111
-#define HEATER_1_PIN        59
100
+#define HEATER_1_PIN       59
112 101
 #define FAN_PIN             9
113 102
 
114 103
 
115
-#define PS_ON_PIN           69
104
+#define PS_ON_PIN          69
116 105
 
117 106
 
118 107
 //
@@ -122,9 +111,9 @@
122 111
 // 5V
123 112
 // NC
124 113
 // GND
125
-#define PIN_P0_17			50
126
-#define PIN_P0_16			16
127
-#define PIN_P0_14			80 
114
+#define PIN_P0_17          50
115
+#define PIN_P0_16          16
116
+#define PIN_P0_14          80
128 117
 
129 118
 
130 119
 //
@@ -132,21 +121,19 @@
132 121
 //
133 122
 
134 123
 // GND
135
-#define PIN_P1_22			41
136
-#define PIN_P1_23			53
137
-#define PIN_P2_12			12
138
-#define PIN_P2_11			35
139
-#define PIN_P4_28			13
140
-
124
+#define PIN_P1_22          41
125
+#define PIN_P1_23          53
126
+#define PIN_P2_12          12
127
+#define PIN_P2_11          35
128
+#define PIN_P4_28          13
141 129
 
142 130
 //
143 131
 // Prusa i3 MK2 Multi Material Multiplexer Support
144 132
 //
145 133
 
146
-
147
-#define E_MUX0_PIN          50   // J7-4
148
-#define E_MUX1_PIN          16   // J7-5
149
-#define E_MUX2_PIN          80   // J7-6
134
+#define E_MUX0_PIN         50   // J7-4
135
+#define E_MUX1_PIN         16   // J7-5
136
+#define E_MUX2_PIN         80   // J7-6
150 137
 
151 138
 
152 139
 /**
@@ -162,72 +149,38 @@
162 149
  * that the garbage/lines are erased immediately after the SD card accesses are completed.
163 150
  */
164 151
 
165
-#if ENABLED(ULTRA_LCD)		// 
166
-
167
-  #define BEEPER_PIN          49  // EXP1.1
168
-
169
-  #define BTN_ENC             37  // EXP1.2 
170
-  #define BTN_EN1             31  // EXP2.5
171
-  #define BTN_EN2             33  // EXP2.3
172
-  
173
-  #define SD_DETECT_PIN       57  // EXP2.7
174
-  #define KILL_PIN            -1  // Not connected
175
-  #define LCD_PINS_RS         16  // EXP1.4
176
-  #define LCD_SDSS            58  // EXP2.4
177
-  #define LCD_BACKLIGHT_PIN   -1  // Not connected
178
-  #define LCD_PINS_ENABLE     51  // EXP1.3
179
-  #define LCD_PINS_D4         80  // EXP1.5
180
-
181
-  #define DOGLCD_A0           -1  // Not connected
182
-  #define DOGLCD_CS           -1  // Not connected
183
-
184
-#ifdef ULTIPANEL
185
-  
186
-  #define LCD_PINS_D5         -1  // EXP1.6 Not connected
187
-  #define LCD_PINS_D6         -1  // EXP1.7 Not connected
188
-  #define LCD_PINS_D7         -1  // EXP1.8 Not connected
189
-#endif
190
- 
191
-
192
-  #if ENABLED(SDSUPPORT)
193
-    #define SDCARD_SORT_ALPHA           // Using SORT feature to keep one directory level in RAM
194
-                                        // When going up/down directory levels the SD card is
195
-                                        // accessed but the garbage/lines are removed when the
196
-                                        // LCD updates
197
-
198
-    // SD Card Sorting options
199
-    #if ENABLED(SDCARD_SORT_ALPHA)
200
-      #define SDSORT_LIMIT       255    // Maximum number of sorted items (10-256).
201
-      #define FOLDER_SORTING     -1     // -1=above  0=none  1=below
202
-      #define SDSORT_GCODE       false  // Allow turning sorting on/off with LCD and M34 g-code.
203
-      #define SDSORT_USES_RAM    true   // Pre-allocate a static array for faster pre-sorting.
204
-      #define SDSORT_USES_STACK  false  // Prefer the stack for pre-sorting to give back some SRAM. (Negated by next 2 options.)
205
-      #define SDSORT_CACHE_NAMES true   // Keep sorted items in RAM longer for speedy performance. Most expensive option.
206
-      #define SDSORT_DYNAMIC_RAM false  // Use dynamic allocation (within SD menus). Least expensive option. Set SDSORT_LIMIT before use!
207
-    #endif
208
-  #endif
152
+#if ENABLED(ULTRA_LCD)
153
+  #define BEEPER_PIN       49  // EXP1.1
154
+  #define BTN_ENC          37  // EXP1.2
155
+  #define BTN_EN1          31  // EXP2.5
156
+  #define BTN_EN2          33  // EXP2.3
157
+  #define SD_DETECT_PIN    57  // EXP2.7
158
+  #define LCD_PINS_RS      16  // EXP1.4
159
+  #define LCD_SDSS         58  // EXP2.4
160
+  #define LCD_PINS_ENABLE  51  // EXP1.3
161
+  #define LCD_PINS_D4      80  // EXP1.5
209 162
 #endif // ULTRA_LCD
210 163
 
211 164
 //
212 165
 // Ethernet pins
213 166
 //
214 167
 #ifndef ULTIPANEL
215
-#define ENET_MDIO   71  // J12-4
216
-#define ENET_RX_ER  73  // J12-6
217
-#define ENET_RXD1   75  // J12-8
168
+  #define ENET_MDIO        71  // J12-4
169
+  #define ENET_RX_ER       73  // J12-6
170
+  #define ENET_RXD1        75  // J12-8
218 171
 #endif
219
-#define ENET_MOC    70  // J12-3
220
-#define REF_CLK     72  // J12-5
221
-#define ENET_RXD0   74  // J12-7
222
-#define ENET_CRS    76  // J12-9
223
-#define ENET_TX_EN  77  // J12-10
224
-#define ENET_TXD0   78  // J12-11
225
-#define ENET_TXD1   79  // J12-12
172
+#define ENET_MOC           70  // J12-3
173
+#define REF_CLK            72  // J12-5
174
+#define ENET_RXD0          74  // J12-7
175
+#define ENET_CRS           76  // J12-9
176
+#define ENET_TX_EN         77  // J12-10
177
+#define ENET_TXD0          78  // J12-11
178
+#define ENET_TXD1          79  // J12-12
226 179
 
227 180
 /**
228
- *  PWMS
181
+ *  PWMs
229 182
  *
230
- *  There are 6 PWMS.  Each PWM can be assigned to one of two pins.
183
+ *  There are 6 PWMs.  Each PWM can be assigned to one of two pins.
231 184
  *
232 185
  *  SERVO2 does NOT have a PWM assigned to it.
233 186
  *
@@ -245,12 +198,11 @@
245 198
  *  PWM1.6   DIO10   RAMPS_D10_PIN
246 199
  */
247 200
 
248
-
249 201
  /**
250
-  * special pins
202
+  * Special pins
251 203
   *   D37 - not 5V tolerant
252 204
   *   D49 - not 5V tolerant
253 205
   *   D57 - open collector
254 206
   *   D58 - open collector
255 207
   *
256
- */
208
+  */

Loading…
Annulla
Salva