Browse Source

Merge pull request #11542 from thinkyhead/bf2_misc_fixes_aug_6

Followup persistent store with heading, const
Scott Lahteine 5 years ago
parent
commit
ccf65c5397
No account linked to committer's email address

+ 22
- 15
Marlin/src/HAL/HAL_AVR/persistent_store_eeprom.cpp View 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 __AVR__
2 23
 
3 24
 #include "../../inc/MarlinConfig.h"
@@ -41,21 +62,7 @@ bool PersistentStore::read_data(int &pos, uint8_t* value, size_t size, uint16_t
41 62
   return false;  // always assume success for AVR's
42 63
 }
43 64
 
44
-bool PersistentStore::write_data(const int pos, uint8_t* value, size_t size) {
45
-  int data_pos = pos;
46
-  uint16_t crc = 0;
47
-  return write_data(data_pos, value, size, &crc);
48
-}
49
-
50
-bool PersistentStore::read_data(const int pos, uint8_t* value, size_t size) {
51
-  int data_pos = pos;
52
-  uint16_t crc = 0;
53
-  return read_data(data_pos, value, size, &crc);
54
-}
55
-
56
-const size_t PersistentStore::capacity() {
57
-  return E2END + 1;
58
-}
65
+const size_t PersistentStore::capacity() { return E2END + 1; }
59 66
 
60 67
 #endif // EEPROM_SETTINGS
61 68
 #endif // __AVR__

+ 23
- 15
Marlin/src/HAL/HAL_DUE/persistent_store_eeprom.cpp View File

@@ -1,3 +1,25 @@
1
+/**
2
+ * Marlin 3D Printer Firmware
3
+ *
4
+ * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
5
+ * Copyright (c) 2016 Bob Cousins bobcousins42@googlemail.com
6
+ * Copyright (c) 2015-2016 Nico Tonnhofer wurstnase.reprap@gmail.com
7
+ * Copyright (c) 2016 Victor Perez victor_pv@hotmail.com
8
+ *
9
+ * This program is free software: you can redistribute it and/or modify
10
+ * it under the terms of the GNU General Public License as published by
11
+ * the Free Software Foundation, either version 3 of the License, or
12
+ * (at your option) any later version.
13
+ *
14
+ * This program is distributed in the hope that it will be useful,
15
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
16
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17
+ * GNU General Public License for more details.
18
+ *
19
+ * You should have received a copy of the GNU General Public License
20
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
21
+ *
22
+ */
1 23
 #ifdef ARDUINO_ARCH_SAM
2 24
 
3 25
 #include "../persistent_store_api.h"
@@ -49,21 +71,7 @@ bool PersistentStore::read_data(int &pos, uint8_t* value, size_t size, uint16_t
49 71
   return false;
50 72
 }
51 73
 
52
-bool PersistentStore::write_data(const int pos, uint8_t* value, size_t size) {
53
-  int data_pos = pos;
54
-  uint16_t crc = 0;
55
-  return write_data(data_pos, value, size, &crc);
56
-}
57
-
58
-bool PersistentStore::read_data(const int pos, uint8_t* value, size_t size) {
59
-  int data_pos = pos;
60
-  uint16_t crc = 0;
61
-  return read_data(data_pos, value, size, &crc);
62
-}
63
-
64
-const size_t PersistentStore::capacity() {
65
-  return E2END + 1;
66
-}
74
+const size_t PersistentStore::capacity() { return E2END + 1; }
67 75
 
68 76
 #endif // EEPROM_SETTINGS
69 77
 #endif // ARDUINO_ARCH_SAM

+ 25
- 30
Marlin/src/HAL/HAL_LPC1768/persistent_store_sdcard.cpp View File

@@ -1,9 +1,10 @@
1 1
 /**
2 2
  * Marlin 3D Printer Firmware
3
- * Copyright (C) 2016, 2017 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
4 3
  *
5
- * Based on Sprinter and grbl.
6
- * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
4
+ * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
5
+ * Copyright (c) 2016 Bob Cousins bobcousins42@googlemail.com
6
+ * Copyright (c) 2015-2016 Nico Tonnhofer wurstnase.reprap@gmail.com
7
+ * Copyright (c) 2016 Victor Perez victor_pv@hotmail.com
7 8
  *
8 9
  * This program is free software: you can redistribute it and/or modify
9 10
  * it under the terms of the GNU General Public License as published by
@@ -98,8 +99,8 @@ bool PersistentStore::access_finish() {
98 99
 //    FR_INVALID_PARAMETER     /* (19) Given parameter is invalid */
99 100
 //  } FRESULT;
100 101
 
101
-bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, uint16_t *crc) {
102
-  if(!eeprom_file_open) return true;
102
+bool PersistentStore::write_data(int &pos, const uint8_t *value, const size_t size, uint16_t *crc) {
103
+  if (!eeprom_file_open) return true;
103 104
   FRESULT s;
104 105
   UINT bytes_written = 0;
105 106
 
@@ -113,7 +114,7 @@ bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, ui
113 114
    return s;
114 115
   }
115 116
 
116
-  s = f_write(&eeprom_file, (void *)value, size, &bytes_written);
117
+  s = f_write(&eeprom_file, (void*)value, size, &bytes_written);
117 118
   if (s) {
118 119
    SERIAL_PROTOCOLPAIR(" write_data(", pos);         // This extra chit-chat goes away soon.  But it is helpful
119 120
    SERIAL_PROTOCOLPAIR(",", (int)value);            // right now to see errors that are happening in the
@@ -129,57 +130,51 @@ bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, ui
129 130
   return (bytes_written != size);  // return true for any error
130 131
 }
131 132
 
132
-bool PersistentStore::read_data(int &pos, uint8_t* value, size_t size, uint16_t *crc, const bool writing/*=true*/) {
133
-  if(!eeprom_file_open) return true;
133
+bool PersistentStore::read_data(int &pos, uint8_t* value, const size_t size, uint16_t *crc, const bool writing/*=true*/) {
134
+  if (!eeprom_file_open) return true;
134 135
   UINT bytes_read = 0;
135 136
   FRESULT s;
136 137
   s = f_lseek(&eeprom_file, pos);
138
+
137 139
   if (s) {
138
-   SERIAL_PROTOCOLPAIR(" read_data(", pos);          // This extra chit-chat goes away soon.  But it is helpful
139
-   SERIAL_PROTOCOLPAIR(",", (int)value);            // right now to see errors that are happening in the
140
-   SERIAL_PROTOCOLPAIR(",", size);             // read_data() and write_data() functions
140
+   SERIAL_PROTOCOLPAIR(" read_data(", pos);         // This extra chit-chat goes away soon.  But it is helpful
141
+   SERIAL_PROTOCOLCHAR(',');
142
+   SERIAL_PROTOCOL((int)value);                     // right now to see errors that are happening in the
143
+   SERIAL_PROTOCOLCHAR(',');
144
+   SERIAL_PROTOCOL(size);                           // read_data() and write_data() functions
141 145
    SERIAL_PROTOCOLLNPGM("...)");
142 146
    SERIAL_PROTOCOLLNPAIR(" f_lseek()=", (int)s);
143 147
    return true;
144 148
   }
149
+
145 150
   if (writing) {
146
-    s = f_read(&eeprom_file, (void *)value, size, &bytes_read);
151
+    s = f_read(&eeprom_file, (void*)value, size, &bytes_read);
147 152
     crc16(crc, value, size);
148 153
   }
149 154
   else {
150 155
     uint8_t temp[size];
151
-    s = f_read(&eeprom_file, (void *)temp, size, &bytes_read);
156
+    s = f_read(&eeprom_file, (void*)temp, size, &bytes_read);
152 157
     crc16(crc, temp, size);
153 158
   }
159
+
154 160
   if (s) {
155 161
    SERIAL_PROTOCOLPAIR(" read_data(", pos);         // This extra chit-chat goes away soon.  But it is helpful
156
-   SERIAL_PROTOCOLPAIR(",", (int)value);           // right now to see errors that are happening in the
157
-   SERIAL_PROTOCOLPAIR(",", size);            // read_data() and write_data() functions
162
+   SERIAL_PROTOCOLCHAR(',');
163
+   SERIAL_PROTOCOL((int)value);                     // right now to see errors that are happening in the
164
+   SERIAL_PROTOCOLCHAR(',');
165
+   SERIAL_PROTOCOL(size);                           // read_data() and write_data() functions
158 166
    SERIAL_PROTOCOLLNPGM("...)");
159 167
    SERIAL_PROTOCOLLNPAIR(" f_write()=", (int)s);
160 168
    SERIAL_PROTOCOLPAIR(" size=", size);
161 169
    SERIAL_PROTOCOLLNPAIR("\n bytes_read=",  bytes_read);
162 170
    return true;
163 171
   }
172
+
164 173
   pos = pos + size;
165 174
   return bytes_read != size;  // return true for any error
166 175
 }
167 176
 
168
-bool PersistentStore::write_data(const int pos, uint8_t* value, size_t size) {
169
-  int data_pos = pos;
170
-  uint16_t crc = 0;
171
-  return write_data(data_pos, value, size, &crc);
172
-}
173
-
174
-bool PersistentStore::read_data(const int pos, uint8_t* value, size_t size) {
175
-  int data_pos = pos;
176
-  uint16_t crc = 0;
177
-  return read_data(data_pos, value, size, &crc);
178
-}
179
-
180
-const size_t PersistentStore::capacity() {
181
-  return 4096; //4KiB of Emulated EEPROM
182
-}
177
+const size_t PersistentStore::capacity() { return 4096; } // 4KiB of Emulated EEPROM
183 178
 
184 179
 #endif // EEPROM_SETTINGS
185 180
 #endif // TARGET_LPC1768

+ 3
- 18
Marlin/src/HAL/HAL_STM32F1/persistent_store_flash.cpp View File

@@ -55,7 +55,7 @@ bool PersistentStore::access_finish() {
55 55
   return true;
56 56
 }
57 57
 
58
-bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, uint16_t *crc) {
58
+bool PersistentStore::write_data(int &pos, const uint8_t *value, const size_t size, uint16_t *crc) {
59 59
   FLASH_Status status;
60 60
 
61 61
   if (firstWrite) {
@@ -90,7 +90,7 @@ bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, ui
90 90
   return false;
91 91
 }
92 92
 
93
-bool PersistentStore::read_data(int &pos, uint8_t* value, size_t size, uint16_t *crc, const bool writing/*=true*/) {
93
+bool PersistentStore::read_data(int &pos, uint8_t* value, const size_t size, uint16_t *crc, const bool writing/*=true*/) {
94 94
   for (uint16_t i = 0; i < size; i++) {
95 95
     byte* accessPoint = (byte*)(pageBase + pos + i);
96 96
     uint8_t c = *accessPoint;
@@ -101,22 +101,7 @@ bool PersistentStore::read_data(int &pos, uint8_t* value, size_t size, uint16_t
101 101
   return false;
102 102
 }
103 103
 
104
-bool PersistentStore::write_data(const int pos, uint8_t* value, size_t size) {
105
-  int data_pos = pos;
106
-  uint16_t crc = 0;
107
-  return write_data(data_pos, value, size, &crc);
108
-}
109
-
110
-bool PersistentStore::read_data(const int pos, uint8_t* value, size_t size) {
111
-  int data_pos = pos;
112
-  uint16_t crc = 0;
113
-  return read_data(data_pos, value, size, &crc);
114
-}
115
-
116
-const size_t PersistentStore::capacity() {
117
-  return E2END + 1;
118
-}
119
-
104
+const size_t PersistentStore::capacity() { return E2END + 1; }
120 105
 
121 106
 #endif // EEPROM_SETTINGS && EEPROM FLASH
122 107
 #endif // __STM32F1__

+ 3
- 17
Marlin/src/HAL/HAL_STM32F1/persistent_store_sdcard.cpp View File

@@ -60,7 +60,7 @@ bool PersistentStore::access_finish() {
60 60
   return (bytes_written == HAL_STM32F1_EEPROM_SIZE);
61 61
 }
62 62
 
63
-bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, uint16_t *crc) {
63
+bool PersistentStore::write_data(int &pos, const uint8_t *value, const size_t size, uint16_t *crc) {
64 64
   for (int i = 0; i < size; i++)
65 65
     HAL_STM32F1_eeprom_content[pos + i] = value[i];
66 66
   crc16(crc, value, size);
@@ -68,7 +68,7 @@ bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, ui
68 68
   return false;
69 69
 }
70 70
 
71
-bool PersistentStore::read_data(int &pos, uint8_t* value, size_t size, uint16_t *crc, const bool writing/*=true*/) {
71
+bool PersistentStore::read_data(int &pos, uint8_t* value, const size_t size, uint16_t *crc, const bool writing/*=true*/) {
72 72
   for (int i = 0; i < size; i++) {
73 73
     uint8_t c = HAL_STM32F1_eeprom_content[pos + i];
74 74
     if (writing) value[i] = c;
@@ -78,21 +78,7 @@ bool PersistentStore::read_data(int &pos, uint8_t* value, size_t size, uint16_t
78 78
   return false;
79 79
 }
80 80
 
81
-bool PersistentStore::write_data(const int pos, uint8_t* value, size_t size) {
82
-  int data_pos = pos;
83
-  uint16_t crc = 0;
84
-  return write_data(data_pos, value, size, &crc);
85
-}
86
-
87
-bool PersistentStore::read_data(const int pos, uint8_t* value, size_t size) {
88
-  int data_pos = pos;
89
-  uint16_t crc = 0;
90
-  return read_data(data_pos, value, size, &crc);
91
-}
92
-
93
-const size_t PersistentStore::capacity() {
94
-  return HAL_STM32F1_EEPROM_SIZE;
95
-}
81
+const size_t PersistentStore::capacity() { return HAL_STM32F1_EEPROM_SIZE; }
96 82
 
97 83
 #endif // EEPROM_SETTINGS
98 84
 

+ 1
- 15
Marlin/src/HAL/HAL_STM32F4/persistent_store_eeprom.cpp View File

@@ -64,21 +64,7 @@ bool PersistentStore::read_data(int &pos, uint8_t* value, size_t size, uint16_t
64 64
   return false;
65 65
 }
66 66
 
67
-bool PersistentStore::write_data(const int pos, uint8_t* value, size_t size) {
68
-  int data_pos = pos;
69
-  uint16_t crc = 0;
70
-  return write_data(data_pos, value, size, &crc);
71
-}
72
-
73
-bool PersistentStore::read_data(const int pos, uint8_t* value, size_t size) {
74
-  int data_pos = pos;
75
-  uint16_t crc = 0;
76
-  return read_data(data_pos, value, size, &crc);
77
-}
78
-
79
-const size_t PersistentStore::capacity() {
80
-  return E2END + 1;
81
-}
67
+const size_t PersistentStore::capacity() { return E2END + 1; }
82 68
 
83 69
 #endif // EEPROM_SETTINGS
84 70
 #endif // STM32F4 || STM32F4xx

+ 1
- 16
Marlin/src/HAL/HAL_STM32F7/persistent_store_eeprom.cpp View File

@@ -21,7 +21,6 @@
21 21
  *
22 22
  */
23 23
 
24
-
25 24
 #ifdef STM32F7
26 25
 
27 26
 #include "../../inc/MarlinConfig.h"
@@ -65,21 +64,7 @@ bool PersistentStore::read_data(int &pos, uint8_t* value, size_t size, uint16_t
65 64
   return false;
66 65
 }
67 66
 
68
-bool PersistentStore::write_data(const int pos, uint8_t* value, size_t size) {
69
-  int data_pos = pos;
70
-  uint16_t crc = 0;
71
-  return write_data(data_pos, value, size, &crc);
72
-}
73
-
74
-bool PersistentStore::read_data(const int pos, uint8_t* value, size_t size) {
75
-  int data_pos = pos;
76
-  uint16_t crc = 0;
77
-  return read_data(data_pos, value, size, &crc);
78
-}
79
-
80
-const size_t PersistentStore::capacity() {
81
-  return E2END + 1;
82
-}
67
+const size_t PersistentStore::capacity() { return E2END + 1; }
83 68
 
84 69
 #endif // EEPROM_SETTINGS
85 70
 #endif // STM32F7

+ 24
- 15
Marlin/src/HAL/HAL_TEENSY35_36/persistent_store_eeprom.cpp View File

@@ -1,3 +1,26 @@
1
+/**
2
+ * Marlin 3D Printer Firmware
3
+ *
4
+ * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
5
+ * Copyright (c) 2016 Bob Cousins bobcousins42@googlemail.com
6
+ * Copyright (c) 2015-2016 Nico Tonnhofer wurstnase.reprap@gmail.com
7
+ * Copyright (c) 2016 Victor Perez victor_pv@hotmail.com
8
+ *
9
+ * This program is free software: you can redistribute it and/or modify
10
+ * it under the terms of the GNU General Public License as published by
11
+ * the Free Software Foundation, either version 3 of the License, or
12
+ * (at your option) any later version.
13
+ *
14
+ * This program is distributed in the hope that it will be useful,
15
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
16
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17
+ * GNU General Public License for more details.
18
+ *
19
+ * You should have received a copy of the GNU General Public License
20
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
21
+ *
22
+ */
23
+
1 24
 #if defined(__MK64FX512__) || defined(__MK66FX1M0__)
2 25
 
3 26
 #include "../../inc/MarlinConfig.h"
@@ -42,21 +65,7 @@ bool PersistentStore::read_data(int &pos, uint8_t* value, size_t size, uint16_t
42 65
   return false;
43 66
 }
44 67
 
45
-bool PersistentStore::write_data(const int pos, uint8_t* value, size_t size) {
46
-  int data_pos = pos;
47
-  uint16_t crc = 0;
48
-  return write_data(data_pos, value, size, &crc);
49
-}
50
-
51
-bool PersistentStore::read_data(const int pos, uint8_t* value, size_t size) {
52
-  int data_pos = pos;
53
-  uint16_t crc = 0;
54
-  return read_data(data_pos, value, size, &crc);
55
-}
56
-
57
-const size_t PersistentStore::capacity() {
58
-  return E2END + 1;
59
-}
68
+const size_t PersistentStore::capacity() { return E2END + 1; }
60 69
 
61 70
 #endif // EEPROM_SETTINGS
62 71
 #endif // __MK64FX512__ || __MK66FX1M0__

+ 4
- 3
Marlin/src/HAL/persistent_store_api.cpp View File

@@ -1,9 +1,10 @@
1 1
 /**
2 2
  * Marlin 3D Printer Firmware
3
- * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
4 3
  *
5
- * Based on Sprinter and grbl.
6
- * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
4
+ * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
5
+ * Copyright (c) 2016 Bob Cousins bobcousins42@googlemail.com
6
+ * Copyright (c) 2015-2016 Nico Tonnhofer wurstnase.reprap@gmail.com
7
+ * Copyright (c) 2016 Victor Perez victor_pv@hotmail.com
7 8
  *
8 9
  * This program is free software: you can redistribute it and/or modify
9 10
  * it under the terms of the GNU General Public License as published by

+ 16
- 5
Marlin/src/HAL/persistent_store_api.h View File

@@ -1,9 +1,10 @@
1 1
 /**
2 2
  * Marlin 3D Printer Firmware
3
- * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
4 3
  *
5
- * Based on Sprinter and grbl.
6
- * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
4
+ * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
5
+ * Copyright (c) 2016 Bob Cousins bobcousins42@googlemail.com
6
+ * Copyright (c) 2015-2016 Nico Tonnhofer wurstnase.reprap@gmail.com
7
+ * Copyright (c) 2016 Victor Perez victor_pv@hotmail.com
7 8
  *
8 9
  * This program is free software: you can redistribute it and/or modify
9 10
  * it under the terms of the GNU General Public License as published by
@@ -30,9 +31,19 @@ public:
30 31
   static bool access_finish();
31 32
   static bool write_data(int &pos, const uint8_t *value, size_t size, uint16_t *crc);
32 33
   static bool read_data(int &pos, uint8_t* value, size_t size, uint16_t *crc, const bool writing=true);
33
-  static bool write_data(const int pos, uint8_t* value, size_t size);
34
-  static bool read_data(const int pos, uint8_t* value, size_t size);
35 34
   static const size_t capacity();
35
+
36
+  static inline bool write_data(const int pos, uint8_t* value, const size_t size) {
37
+    int data_pos = pos;
38
+    uint16_t crc = 0;
39
+    return write_data(data_pos, value, size, &crc);
40
+  }
41
+
42
+  static inline bool read_data(const int pos, uint8_t* value, const size_t size) {
43
+    int data_pos = pos;
44
+    uint16_t crc = 0;
45
+    return read_data(data_pos, value, size, &crc);
46
+  }
36 47
 };
37 48
 
38 49
 extern PersistentStore persistentStore;

+ 3
- 3
Marlin/src/feature/bedlevel/ubl/ubl.h View File

@@ -215,7 +215,7 @@ class unified_bed_leveling {
215 215
      * z_correction_for_x_on_horizontal_mesh_line is an optimization for
216 216
      * the case where the printer is making a vertical line that only crosses horizontal mesh lines.
217 217
      */
218
-    inline static float z_correction_for_x_on_horizontal_mesh_line(const float &rx0, const int x1_i, const int yi) {
218
+    static inline float z_correction_for_x_on_horizontal_mesh_line(const float &rx0, const int x1_i, const int yi) {
219 219
       if (!WITHIN(x1_i, 0, GRID_MAX_POINTS_X - 1) || !WITHIN(yi, 0, GRID_MAX_POINTS_Y - 1)) {
220 220
         #if ENABLED(DEBUG_LEVELING_FEATURE)
221 221
           if (DEBUGGING(LEVELING)) {
@@ -249,7 +249,7 @@ class unified_bed_leveling {
249 249
     //
250 250
     // See comments above for z_correction_for_x_on_horizontal_mesh_line
251 251
     //
252
-    inline static float z_correction_for_y_on_vertical_mesh_line(const float &ry0, const int xi, const int y1_i) {
252
+    static inline float z_correction_for_y_on_vertical_mesh_line(const float &ry0, const int xi, const int y1_i) {
253 253
       if (!WITHIN(xi, 0, GRID_MAX_POINTS_X - 1) || !WITHIN(y1_i, 0, GRID_MAX_POINTS_Y - 1)) {
254 254
         #if ENABLED(DEBUG_LEVELING_FEATURE)
255 255
           if (DEBUGGING(LEVELING)) {
@@ -362,7 +362,7 @@ class unified_bed_leveling {
362 362
       static void line_to_destination_cartesian(const float &fr, const uint8_t e);
363 363
     #endif
364 364
 
365
-    inline static bool mesh_is_valid() {
365
+    static inline bool mesh_is_valid() {
366 366
       for (uint8_t x = 0; x < GRID_MAX_POINTS_X; x++)
367 367
         for (uint8_t y = 0; y < GRID_MAX_POINTS_Y; y++)
368 368
           if (isnan(z_values[x][y])) return false;

+ 15
- 15
Marlin/src/gcode/parser.h View File

@@ -175,10 +175,10 @@ public:
175 175
   FORCE_INLINE static bool has_value() { return value_ptr != NULL; }
176 176
 
177 177
   // Seen a parameter with a value
178
-  inline static bool seenval(const char c) { return seen(c) && has_value(); }
178
+  static inline bool seenval(const char c) { return seen(c) && has_value(); }
179 179
 
180 180
   // Float removes 'E' to prevent scientific notation interpretation
181
-  inline static float value_float() {
181
+  static inline float value_float() {
182 182
     if (value_ptr) {
183 183
       char *e = value_ptr;
184 184
       for (;;) {
@@ -198,8 +198,8 @@ public:
198 198
   }
199 199
 
200 200
   // Code value as a long or ulong
201
-  inline static int32_t value_long() { return value_ptr ? strtol(value_ptr, NULL, 10) : 0L; }
202
-  inline static uint32_t value_ulong() { return value_ptr ? strtoul(value_ptr, NULL, 10) : 0UL; }
201
+  static inline int32_t value_long() { return value_ptr ? strtol(value_ptr, NULL, 10) : 0L; }
202
+  static inline uint32_t value_ulong() { return value_ptr ? strtoul(value_ptr, NULL, 10) : 0UL; }
203 203
 
204 204
   // Code value for use as time
205 205
   FORCE_INLINE static millis_t value_millis() { return value_ulong(); }
@@ -208,10 +208,10 @@ public:
208 208
   // Reduce to fewer bits
209 209
   FORCE_INLINE static int16_t value_int() { return (int16_t)value_long(); }
210 210
   FORCE_INLINE static uint16_t value_ushort() { return (uint16_t)value_long(); }
211
-  inline static uint8_t value_byte() { return (uint8_t)constrain(value_long(), 0, 255); }
211
+  static inline uint8_t value_byte() { return (uint8_t)constrain(value_long(), 0, 255); }
212 212
 
213 213
   // Bool is true with no value or non-zero
214
-  inline static bool value_bool() { return !has_value() || !!value_byte(); }
214
+  static inline bool value_bool() { return !has_value() || !!value_byte(); }
215 215
 
216 216
   // Units modes: Inches, Fahrenheit, Kelvin
217 217
 
@@ -220,7 +220,7 @@ public:
220 220
     // Init linear units by constructor
221 221
     GCodeParser() { set_input_linear_units(LINEARUNIT_MM); }
222 222
 
223
-    inline static void set_input_linear_units(const LinearUnit units) {
223
+    static inline void set_input_linear_units(const LinearUnit units) {
224 224
       switch (units) {
225 225
         case LINEARUNIT_INCH:
226 226
           linear_unit_factor = 25.4f;
@@ -233,13 +233,13 @@ public:
233 233
       volumetric_unit_factor = POW(linear_unit_factor, 3);
234 234
     }
235 235
 
236
-    inline static float axis_unit_factor(const AxisEnum axis) {
236
+    static inline float axis_unit_factor(const AxisEnum axis) {
237 237
       return (axis >= E_AXIS && volumetric_enabled ? volumetric_unit_factor : linear_unit_factor);
238 238
     }
239 239
 
240
-    inline static float value_linear_units()                     { return value_float() * linear_unit_factor; }
241
-    inline static float value_axis_units(const AxisEnum axis)    { return value_float() * axis_unit_factor(axis); }
242
-    inline static float value_per_axis_unit(const AxisEnum axis) { return value_float() / axis_unit_factor(axis); }
240
+    static inline float value_linear_units()                     { return value_float() * linear_unit_factor; }
241
+    static inline float value_axis_units(const AxisEnum axis)    { return value_float() * axis_unit_factor(axis); }
242
+    static inline float value_per_axis_unit(const AxisEnum axis) { return value_float() / axis_unit_factor(axis); }
243 243
 
244 244
   #else
245 245
 
@@ -251,7 +251,7 @@ public:
251 251
 
252 252
   #if ENABLED(TEMPERATURE_UNITS_SUPPORT)
253 253
 
254
-    inline static void set_input_temp_units(TempUnit units) { input_temp_units = units; }
254
+    static inline void set_input_temp_units(TempUnit units) { input_temp_units = units; }
255 255
 
256 256
     #if ENABLED(ULTIPANEL) && DISABLED(DISABLE_M503)
257 257
 
@@ -261,7 +261,7 @@ public:
261 261
       FORCE_INLINE static const char* temp_units_name() {
262 262
         return input_temp_units == TEMPUNIT_K ? PSTR("Kelvin") : input_temp_units == TEMPUNIT_F ? PSTR("Fahrenheit") : PSTR("Celsius");
263 263
       }
264
-      inline static float to_temp_units(const float &f) {
264
+      static inline float to_temp_units(const float &f) {
265 265
         switch (input_temp_units) {
266 266
           case TEMPUNIT_F:
267 267
             return f * 0.5555555556f + 32;
@@ -275,7 +275,7 @@ public:
275 275
 
276 276
     #endif // ULTIPANEL && !DISABLE_M503
277 277
 
278
-    inline static float value_celsius() {
278
+    static inline float value_celsius() {
279 279
       const float f = value_float();
280 280
       switch (input_temp_units) {
281 281
         case TEMPUNIT_F:
@@ -288,7 +288,7 @@ public:
288 288
       }
289 289
     }
290 290
 
291
-    inline static float value_celsius_diff() {
291
+    static inline float value_celsius_diff() {
292 292
       switch (input_temp_units) {
293 293
         case TEMPUNIT_F:
294 294
           return value_float() * 0.5555555556f;

+ 1
- 1
Marlin/src/libs/buzzer.h View File

@@ -82,7 +82,7 @@ class Buzzer {
82 82
      * @brief Resets the state of the class
83 83
      * @details Brings the class state to a known one.
84 84
      */
85
-    inline static void reset() {
85
+    static inline void reset() {
86 86
       off();
87 87
       state.endtime = 0;
88 88
     }

+ 1
- 1
Marlin/src/module/planner.h View File

@@ -361,7 +361,7 @@ class Planner {
361 361
        *  Returns 1.0 if planner.z_fade_height is 0.0.
362 362
        *  Returns 0.0 if Z is past the specified 'Fade Height'.
363 363
        */
364
-      inline static float fade_scaling_factor_for_z(const float &rz) {
364
+      static inline float fade_scaling_factor_for_z(const float &rz) {
365 365
         static float z_fade_factor = 1;
366 366
         if (z_fade_height) {
367 367
           if (rz >= z_fade_height) return 0;

+ 9
- 10
Marlin/src/module/planner_bezier.cpp View File

@@ -45,7 +45,7 @@
45 45
 #define SIGMA 0.1f
46 46
 
47 47
 // Compute the linear interpolation between two real numbers.
48
-inline static float interp(float a, float b, float t) { return (1 - t) * a + t * b; }
48
+static inline float interp(const float &a, const float &b, const float &t) { return (1 - t) * a + t * b; }
49 49
 
50 50
 /**
51 51
  * Compute a Bézier curve using the De Casteljau's algorithm (see
@@ -53,21 +53,20 @@ inline static float interp(float a, float b, float t) { return (1 - t) * a + t *
53 53
  * easy to code and has good numerical stability (very important,
54 54
  * since Arudino works with limited precision real numbers).
55 55
  */
56
-inline static float eval_bezier(float a, float b, float c, float d, float t) {
57
-  float iab = interp(a, b, t);
58
-  float ibc = interp(b, c, t);
59
-  float icd = interp(c, d, t);
60
-  float iabc = interp(iab, ibc, t);
61
-  float ibcd = interp(ibc, icd, t);
62
-  float iabcd = interp(iabc, ibcd, t);
63
-  return iabcd;
56
+static inline float eval_bezier(const float &a, const float &b, const float &c, const float &d, const float &t) {
57
+  const float iab = interp(a, b, t),
58
+              ibc = interp(b, c, t),
59
+              icd = interp(c, d, t),
60
+              iabc = interp(iab, ibc, t),
61
+              ibcd = interp(ibc, icd, t);
62
+  return interp(iabc, ibcd, t);
64 63
 }
65 64
 
66 65
 /**
67 66
  * We approximate Euclidean distance with the sum of the coordinates
68 67
  * offset (so-called "norm 1"), which is quicker to compute.
69 68
  */
70
-inline static float dist1(float x1, float y1, float x2, float y2) { return ABS(x1 - x2) + ABS(y1 - y2); }
69
+static inline float dist1(const float &x1, const float &y1, const float &x2, const float &y2) { return ABS(x1 - x2) + ABS(y1 - y2); }
71 70
 
72 71
 /**
73 72
  * The algorithm for computing the step is loosely based on the one in Kig

+ 2
- 2
Marlin/src/module/stepper.h View File

@@ -435,7 +435,7 @@ class Stepper {
435 435
     #endif
436 436
 
437 437
     // Set the current position in steps
438
-    inline static void set_position(const int32_t &a, const int32_t &b, const int32_t &c, const int32_t &e) {
438
+    static inline void set_position(const int32_t &a, const int32_t &b, const int32_t &c, const int32_t &e) {
439 439
       planner.synchronize();
440 440
       const bool was_enabled = STEPPER_ISR_ENABLED();
441 441
       if (was_enabled) DISABLE_STEPPER_DRIVER_INTERRUPT();
@@ -443,7 +443,7 @@ class Stepper {
443 443
       if (was_enabled) ENABLE_STEPPER_DRIVER_INTERRUPT();
444 444
     }
445 445
 
446
-    inline static void set_position(const AxisEnum a, const int32_t &v) {
446
+    static inline void set_position(const AxisEnum a, const int32_t &v) {
447 447
       planner.synchronize();
448 448
 
449 449
       #ifdef __AVR__

Loading…
Cancel
Save