Bläddra i källkod

[2.0.x] Squelch compiler warnings seen with -Wall (#11889)

Marcio Teixeira 6 år sedan
förälder
incheckning
c411e7eb0d

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

@@ -41,7 +41,7 @@
41 41
 #define EEPROMSize     4096
42 42
 #define PagesPerGroup   128
43 43
 #define GroupCount        2
44
-#define PageSize        256
44
+#define PageSize        256u
45 45
 
46 46
  /* Flash storage */
47 47
 typedef struct FLASH_SECTOR {
@@ -109,9 +109,9 @@ static const FLASH_SECTOR_T* getFlashStorage(int page) {
109 109
   return (const FLASH_SECTOR_T*)&flashStorage[page*PageSize];
110 110
 }
111 111
 
112
-static uint8_t buffer[256] = {0};   // The RAM buffer to accumulate writes
113
-static uint8_t curPage = 0;         // Current FLASH page inside the group
114
-static uint8_t curGroup = 0xFF;     // Current FLASH group
112
+static uint8_t buffer[256] = {0},   // The RAM buffer to accumulate writes
113
+               curPage = 0,         // Current FLASH page inside the group
114
+               curGroup = 0xFF;     // Current FLASH group
115 115
 
116 116
 //#define EE_EMU_DEBUG
117 117
 #ifdef EE_EMU_DEBUG
@@ -125,12 +125,10 @@ static uint8_t curGroup = 0xFF;     // Current FLASH group
125 125
 
126 126
     char* p = &buffer[0];
127 127
     for (int i = 0; i< PageSize; ++i) {
128
-      if ((i & 15) == 0) {
129
-        p += sprintf(p,"%04x] ",i);
130
-      }
128
+      if ((i & 0xF) == 0) p += sprintf(p,"%04x] ", i);
131 129
 
132
-      p += sprintf(p," %02x",c[i]);
133
-      if ((i & 15) == 15) {
130
+      p += sprintf(p," %02x", c[i]);
131
+      if ((i & 0xF) == 0xF) {
134 132
         *p++ = '\n';
135 133
         *p = 0;
136 134
         SERIAL_PROTOCOL(buffer);
@@ -160,7 +158,7 @@ static uint8_t curGroup = 0xFF;     // Current FLASH group
160 158
 __attribute__ ((long_call, section (".ramfunc")))
161 159
 static bool ee_PageWrite(uint16_t page,const void* data) {
162 160
 
163
-  int i;
161
+  uint16_t i;
164 162
   uint32_t addrflash = ((uint32_t)getFlashStorage(page));
165 163
 
166 164
   // Read the flash contents
@@ -173,15 +171,14 @@ static bool ee_PageWrite(uint16_t page,const void* data) {
173 171
   // Programming mode works only with 128-bit (or higher) boundaries. It cannot
174 172
   // be used with boundaries lower than 128 bits (8, 16 or 32-bit for example)."
175 173
   // All bits that did not change, set them to 1.
176
-  for (i = 0; i <PageSize >> 2; i++) {
174
+  for (i = 0; i <PageSize >> 2; i++)
177 175
     pageContents[i] = (((uint32_t*)data)[i]) | (~(pageContents[i] ^ ((uint32_t*)data)[i]));
178
-  }
179 176
 
180 177
   #ifdef EE_EMU_DEBUG
181 178
     SERIAL_ECHO_START();
182
-    SERIAL_ECHOLNPAIR("EEPROM PageWrite   ",page);
183
-    SERIAL_ECHOLNPAIR(" in FLASH address ",(uint32_t)addrflash);
184
-    SERIAL_ECHOLNPAIR(" base address     ",(uint32_t)getFlashStorage(0));
179
+    SERIAL_ECHOLNPAIR("EEPROM PageWrite   ", page);
180
+    SERIAL_ECHOLNPAIR(" in FLASH address ", (uint32_t)addrflash);
181
+    SERIAL_ECHOLNPAIR(" base address     ", (uint32_t)getFlashStorage(0));
185 182
     SERIAL_FLUSH();
186 183
   #endif
187 184
 
@@ -207,7 +204,7 @@ static bool ee_PageWrite(uint16_t page,const void* data) {
207 204
   uint32_t orgWS = (efc->EEFC_FMR & EEFC_FMR_FWS_Msk) >> EEFC_FMR_FWS_Pos;
208 205
 
209 206
   // Set wait states to 6 (SAM errata)
210
-  efc->EEFC_FMR = efc->EEFC_FMR & (~EEFC_FMR_FWS_Msk) | EEFC_FMR_FWS(6);
207
+  efc->EEFC_FMR = (efc->EEFC_FMR & (~EEFC_FMR_FWS_Msk)) | EEFC_FMR_FWS(6);
211 208
 
212 209
   // Unlock the flash page
213 210
   uint32_t status;
@@ -220,14 +217,14 @@ static bool ee_PageWrite(uint16_t page,const void* data) {
220 217
   if ((status & EEFC_ERROR_FLAGS) != 0) {
221 218
 
222 219
     // Restore original wait states
223
-    efc->EEFC_FMR = efc->EEFC_FMR & (~EEFC_FMR_FWS_Msk) | EEFC_FMR_FWS(orgWS);
220
+    efc->EEFC_FMR = (efc->EEFC_FMR & (~EEFC_FMR_FWS_Msk)) | EEFC_FMR_FWS(orgWS);
224 221
 
225 222
     // Reenable interrupts
226 223
     __enable_irq();
227 224
 
228 225
     #ifdef EE_EMU_DEBUG
229 226
       SERIAL_ECHO_START();
230
-      SERIAL_ECHOLNPAIR("EEPROM Unlock failure for page ",page);
227
+      SERIAL_ECHOLNPAIR("EEPROM Unlock failure for page ", page);
231 228
     #endif
232 229
     return false;
233 230
   }
@@ -247,20 +244,20 @@ static bool ee_PageWrite(uint16_t page,const void* data) {
247 244
   if ((status & EEFC_ERROR_FLAGS) != 0) {
248 245
 
249 246
     // Restore original wait states
250
-    efc->EEFC_FMR = efc->EEFC_FMR & (~EEFC_FMR_FWS_Msk) | EEFC_FMR_FWS(orgWS);
247
+    efc->EEFC_FMR = (efc->EEFC_FMR & (~EEFC_FMR_FWS_Msk)) | EEFC_FMR_FWS(orgWS);
251 248
 
252 249
     // Reenable interrupts
253 250
     __enable_irq();
254 251
 
255 252
     #ifdef EE_EMU_DEBUG
256 253
       SERIAL_ECHO_START();
257
-      SERIAL_ECHOLNPAIR("EEPROM Write failure for page ",page);
254
+      SERIAL_ECHOLNPAIR("EEPROM Write failure for page ", page);
258 255
     #endif
259 256
     return false;
260 257
   }
261 258
 
262 259
   // Restore original wait states
263
-  efc->EEFC_FMR = efc->EEFC_FMR & (~EEFC_FMR_FWS_Msk) | EEFC_FMR_FWS(orgWS);
260
+  efc->EEFC_FMR = (efc->EEFC_FMR & (~EEFC_FMR_FWS_Msk)) | EEFC_FMR_FWS(orgWS);
264 261
 
265 262
   // Reenable interrupts
266 263
   __enable_irq();
@@ -270,7 +267,7 @@ static bool ee_PageWrite(uint16_t page,const void* data) {
270 267
 
271 268
     #ifdef EE_EMU_DEBUG
272 269
       SERIAL_ECHO_START();
273
-      SERIAL_ECHOLNPAIR("EEPROM Verify Write failure for page ",page);
270
+      SERIAL_ECHOLNPAIR("EEPROM Verify Write failure for page ", page);
274 271
 
275 272
       ee_Dump( page,(uint32_t *) addrflash);
276 273
       ee_Dump(-page,data);
@@ -289,7 +286,7 @@ static bool ee_PageWrite(uint16_t page,const void* data) {
289 286
           }
290 287
         }
291 288
       }
292
-      SERIAL_ECHOLNPAIR("--> Differing bits: ",count);
289
+      SERIAL_ECHOLNPAIR("--> Differing bits: ", count);
293 290
     #endif
294 291
 
295 292
     return false;
@@ -305,7 +302,7 @@ static bool ee_PageWrite(uint16_t page,const void* data) {
305 302
 __attribute__ ((long_call, section (".ramfunc")))
306 303
 static bool ee_PageErase(uint16_t page) {
307 304
 
308
-  int i;
305
+  uint16_t i;
309 306
   uint32_t addrflash = ((uint32_t)getFlashStorage(page));
310 307
 
311 308
   #ifdef EE_EMU_DEBUG
@@ -338,7 +335,7 @@ static bool ee_PageErase(uint16_t page) {
338 335
   uint32_t orgWS = (efc->EEFC_FMR & EEFC_FMR_FWS_Msk) >> EEFC_FMR_FWS_Pos;
339 336
 
340 337
   // Set wait states to 6 (SAM errata)
341
-  efc->EEFC_FMR = efc->EEFC_FMR & (~EEFC_FMR_FWS_Msk) | EEFC_FMR_FWS(6);
338
+  efc->EEFC_FMR = (efc->EEFC_FMR & (~EEFC_FMR_FWS_Msk)) | EEFC_FMR_FWS(6);
342 339
 
343 340
   // Unlock the flash page
344 341
   uint32_t status;
@@ -350,7 +347,7 @@ static bool ee_PageErase(uint16_t page) {
350 347
   if ((status & EEFC_ERROR_FLAGS) != 0) {
351 348
 
352 349
     // Restore original wait states
353
-    efc->EEFC_FMR = efc->EEFC_FMR & (~EEFC_FMR_FWS_Msk) | EEFC_FMR_FWS(orgWS);
350
+    efc->EEFC_FMR = (efc->EEFC_FMR & (~EEFC_FMR_FWS_Msk)) | EEFC_FMR_FWS(orgWS);
354 351
 
355 352
     // Reenable interrupts
356 353
     __enable_irq();
@@ -375,7 +372,7 @@ static bool ee_PageErase(uint16_t page) {
375 372
   if ((status & EEFC_ERROR_FLAGS) != 0) {
376 373
 
377 374
     // Restore original wait states
378
-    efc->EEFC_FMR = efc->EEFC_FMR & (~EEFC_FMR_FWS_Msk) | EEFC_FMR_FWS(orgWS);
375
+    efc->EEFC_FMR = (efc->EEFC_FMR & (~EEFC_FMR_FWS_Msk)) | EEFC_FMR_FWS(orgWS);
379 376
 
380 377
     // Reenable interrupts
381 378
     __enable_irq();
@@ -388,7 +385,7 @@ static bool ee_PageErase(uint16_t page) {
388 385
   }
389 386
 
390 387
   // Restore original wait states
391
-  efc->EEFC_FMR = efc->EEFC_FMR & (~EEFC_FMR_FWS_Msk) | EEFC_FMR_FWS(orgWS);
388
+  efc->EEFC_FMR = (efc->EEFC_FMR & (~EEFC_FMR_FWS_Msk)) | EEFC_FMR_FWS(orgWS);
392 389
 
393 390
   // Reenable interrupts
394 391
   __enable_irq();
@@ -421,7 +418,7 @@ static uint8_t ee_Read(uint32_t address, bool excludeRAMBuffer = false) {
421 418
 
422 419
   // Check that the value is not contained in the RAM buffer
423 420
   if (!excludeRAMBuffer) {
424
-    int i = 0;
421
+    uint16_t i = 0;
425 422
     while (i <= (PageSize - 4)) { /* (PageSize - 4) because otherwise, there is not enough room for data and headers */
426 423
 
427 424
       // Get the address of the block
@@ -462,7 +459,7 @@ static uint8_t ee_Read(uint32_t address, bool excludeRAMBuffer = false) {
462 459
     // Get a pointer to the flash page
463 460
     uint8_t* pflash = (uint8_t*)getFlashStorage(page + curGroup * PagesPerGroup);
464 461
 
465
-    int i = 0;
462
+    uint16_t i = 0;
466 463
     while (i <= (PageSize - 4)) { /* (PageSize - 4) because otherwise, there is not enough room for data and headers */
467 464
 
468 465
       // Get the address of the block
@@ -476,18 +473,13 @@ static uint8_t ee_Read(uint32_t address, bool excludeRAMBuffer = false) {
476 473
         break;
477 474
 
478 475
       // Check if data is contained in this block
479
-      if (address >= baddr &&
480
-        address < (baddr + blen)) {
481
-
482
-        // Yes, it is contained. Return it!
483
-        return pflash[i + 3 + address - baddr];
484
-      }
476
+      if (address >= baddr && address < (baddr + blen))
477
+        return pflash[i + 3 + address - baddr]; // Yes, it is contained. Return it!
485 478
 
486 479
       // As blocks are always sorted, if the starting address of this block is higher
487 480
       // than the address we are looking for, break loop now - We wont find the value
488 481
       // associated to the address
489
-      if (baddr > address)
490
-        break;
482
+      if (baddr > address) break;
491 483
 
492 484
       // Jump to the next block
493 485
       i += 3 + blen;
@@ -499,14 +491,14 @@ static uint8_t ee_Read(uint32_t address, bool excludeRAMBuffer = false) {
499 491
 }
500 492
 
501 493
 static uint32_t ee_GetAddrRange(uint32_t address, bool excludeRAMBuffer = false) {
502
-  uint32_t baddr;
503
-  uint32_t blen;
504
-  uint32_t nextAddr = 0xFFFF;
505
-  uint32_t nextRange = 0;
494
+  uint32_t baddr,
495
+           blen,
496
+           nextAddr = 0xFFFF,
497
+           nextRange = 0;
506 498
 
507 499
   // Check that the value is not contained in the RAM buffer
508 500
   if (!excludeRAMBuffer) {
509
-    int i = 0;
501
+    uint16_t i = 0;
510 502
     while (i <= (PageSize - 4)) { /* (PageSize - 4) because otherwise, there is not enough room for data and headers */
511 503
 
512 504
       // Get the address of the block
@@ -516,16 +508,11 @@ static uint32_t ee_GetAddrRange(uint32_t address, bool excludeRAMBuffer = false)
516 508
       blen = buffer[i + 2];
517 509
 
518 510
       // If we reach the end of the list, break loop
519
-      if (blen == 0xFF)
520
-        break;
511
+      if (blen == 0xFF) break;
521 512
 
522 513
       // Check if address and address + 1 is contained in this block
523
-      if (address >= baddr &&
524
-        address < (baddr + blen)) {
525
-
526
-        // Yes, it is contained. Return it!
527
-        return address | ((blen - address + baddr) << 16);
528
-      }
514
+      if (address >= baddr && address < (baddr + blen))
515
+        return address | ((blen - address + baddr) << 16); // Yes, it is contained. Return it!
529 516
 
530 517
       // Otherwise, check if we can use it as a limit
531 518
       if (baddr > address && baddr < nextAddr) {
@@ -536,8 +523,7 @@ static uint32_t ee_GetAddrRange(uint32_t address, bool excludeRAMBuffer = false)
536 523
       // As blocks are always sorted, if the starting address of this block is higher
537 524
       // than the address we are looking for, break loop now - We wont find the value
538 525
       // associated to the address
539
-      if (baddr > address)
540
-        break;
526
+      if (baddr > address) break;
541 527
 
542 528
       // Jump to the next block
543 529
       i += 3 + blen;
@@ -553,7 +539,7 @@ static uint32_t ee_GetAddrRange(uint32_t address, bool excludeRAMBuffer = false)
553 539
     // Get a pointer to the flash page
554 540
     uint8_t* pflash = (uint8_t*)getFlashStorage(page + curGroup * PagesPerGroup);
555 541
 
556
-    int i = 0;
542
+    uint16_t i = 0;
557 543
     while (i <= (PageSize - 4)) { /* (PageSize - 4) because otherwise, there is not enough room for data and headers */
558 544
 
559 545
       // Get the address of the block
@@ -563,16 +549,11 @@ static uint32_t ee_GetAddrRange(uint32_t address, bool excludeRAMBuffer = false)
563 549
       blen = pflash[i + 2];
564 550
 
565 551
       // If we reach the end of the list, break loop
566
-      if (blen == 0xFF)
567
-        break;
552
+      if (blen == 0xFF) break;
568 553
 
569 554
       // Check if data is contained in this block
570
-      if (address >= baddr &&
571
-        address < (baddr + blen)) {
572
-
573
-        // Yes, it is contained. Return it!
574
-        return address | ((blen - address + baddr) << 16);
575
-      }
555
+      if (address >= baddr && address < (baddr + blen))
556
+        return address | ((blen - address + baddr) << 16); // Yes, it is contained. Return it!
576 557
 
577 558
       // Otherwise, check if we can use it as a limit
578 559
       if (baddr > address && baddr < nextAddr) {
@@ -583,8 +564,7 @@ static uint32_t ee_GetAddrRange(uint32_t address, bool excludeRAMBuffer = false)
583 564
       // As blocks are always sorted, if the starting address of this block is higher
584 565
       // than the address we are looking for, break loop now - We wont find the value
585 566
       // associated to the address
586
-      if (baddr > address)
587
-        break;
567
+      if (baddr > address) break;
588 568
 
589 569
       // Jump to the next block
590 570
       i += 3 + blen;
@@ -596,12 +576,9 @@ static uint32_t ee_GetAddrRange(uint32_t address, bool excludeRAMBuffer = false)
596 576
 }
597 577
 
598 578
 static bool ee_IsPageClean(int page) {
599
-
600 579
   uint32_t* pflash = (uint32_t*) getFlashStorage(page);
601
-  for (int i = 0; i < (PageSize >> 2); ++i) {
602
-    if (*pflash++ != 0xFFFFFFFF)
603
-      return false;
604
-  }
580
+  for (uint16_t i = 0; i < (PageSize >> 2); ++i)
581
+    if (*pflash++ != 0xFFFFFFFF) return false;
605 582
   return true;
606 583
 }
607 584
 
@@ -610,7 +587,7 @@ static bool ee_Flush(uint32_t overrideAddress = 0xFFFFFFFF, uint8_t overrideData
610 587
   // Check if RAM buffer has something to be written
611 588
   bool isEmpty = true;
612 589
   uint32_t* p = (uint32_t*) &buffer[0];
613
-  for (int j = 0; j < (PageSize >> 2); j++) {
590
+  for (uint16_t j = 0; j < (PageSize >> 2); j++) {
614 591
     if (*p++ != 0xFFFFFFFF) {
615 592
       isEmpty = false;
616 593
       break;
@@ -648,13 +625,11 @@ static bool ee_Flush(uint32_t overrideAddress = 0xFFFFFFFF, uint8_t overrideData
648 625
   }
649 626
 
650 627
   // We have no space left on the current group - We must compact the values
651
-  int i = 0;
628
+  uint16_t i = 0;
652 629
 
653 630
   // Compute the next group to use
654
-  int curwPage = 0;
655
-  int curwGroup = curGroup + 1;
656
-  if (curwGroup >= GroupCount)
657
-    curwGroup = 0;
631
+  int curwPage = 0, curwGroup = curGroup + 1;
632
+  if (curwGroup >= GroupCount) curwGroup = 0;
658 633
 
659 634
   uint32_t rdAddr = 0;
660 635
   do {
@@ -774,12 +749,11 @@ static bool ee_Flush(uint32_t overrideAddress = 0xFFFFFFFF, uint8_t overrideData
774 749
 static bool ee_Write(uint32_t address, uint8_t data) {
775 750
 
776 751
   // If we were requested an address outside of the emulated range, fail now
777
-  if (address >= EEPROMSize)
778
-    return false;
752
+  if (address >= EEPROMSize) return false;
779 753
 
780 754
   // Lets check if we have a block with that data previously defined. Block
781 755
   //  start addresses are always sorted in ascending order
782
-  int i = 0;
756
+  uint16_t i = 0;
783 757
   while (i <= (PageSize - 4)) { /* (PageSize - 4) because otherwise, there is not enough room for data and headers */
784 758
 
785 759
     // Get the address of the block
@@ -805,8 +779,7 @@ static bool ee_Write(uint32_t address, uint8_t data) {
805 779
 
806 780
     // Maybe we could add it to the front or to the back
807 781
     // of this block ?
808
-    if ((address + 1) == baddr ||
809
-      address == (baddr + blen)) {
782
+    if ((address + 1) == baddr || address == (baddr + blen)) {
810 783
 
811 784
       // Potentially, it could be done. But we must ensure there is room
812 785
       // so we can expand the block. Lets find how much free space remains
@@ -840,9 +813,9 @@ static bool ee_Write(uint32_t address, uint8_t data) {
840 813
 
841 814
           // Insert at the end - There is a very interesting thing that could happen here:
842 815
           //  Maybe we could coalesce the next block with this block. Let's try to do it!
843
-          int inext = i + 3 + blen;
816
+          uint16_t inext = i + 3 + blen;
844 817
           if (inext <= (PageSize - 4) &&
845
-            (buffer[inext] | (buffer[inext + 1] << 8)) == (baddr + blen + 1)) {
818
+            (buffer[inext] | (uint16_t(buffer[inext + 1]) << 8)) == (baddr + blen + 1)) {
846 819
             // YES! ... we can coalesce blocks! . Do it!
847 820
 
848 821
             // Adjust this block header to include the next one
@@ -879,8 +852,7 @@ static bool ee_Write(uint32_t address, uint8_t data) {
879 852
     // As blocks are always sorted, if the starting address of this block is higher
880 853
     // than the address we are looking for, break loop now - We wont find the value
881 854
     // associated to the address
882
-    if (baddr > address)
883
-      break;
855
+    if (baddr > address) break;
884 856
 
885 857
     // Jump to the next block
886 858
     i += 3 + blen;
@@ -924,21 +896,17 @@ static bool ee_Write(uint32_t address, uint8_t data) {
924 896
 static void ee_Init() {
925 897
 
926 898
   // Just init once!
927
-  if (curGroup != 0xFF)
928
-    return;
899
+  if (curGroup != 0xFF) return;
929 900
 
930 901
   // Clean up the SRAM buffer
931 902
   memset(buffer, 0xFF, sizeof(buffer));
932 903
 
933 904
   // Now, we must find out the group where settings are stored
934
-  for (curGroup = 0; curGroup < GroupCount; curGroup++) {
935
-    if (!ee_IsPageClean(curGroup * PagesPerGroup))
936
-      break;
937
-  }
905
+  for (curGroup = 0; curGroup < GroupCount; curGroup++)
906
+    if (!ee_IsPageClean(curGroup * PagesPerGroup)) break;
938 907
 
939 908
   // If all groups seem to be used, default to first group
940
-  if (curGroup >= GroupCount)
941
-    curGroup = 0;
909
+  if (curGroup >= GroupCount) curGroup = 0;
942 910
 
943 911
   #ifdef EE_EMU_DEBUG
944 912
     SERIAL_ECHO_START();
@@ -948,8 +916,7 @@ static void ee_Init() {
948 916
 
949 917
   // Now, validate that all the other group pages are empty
950 918
   for (int grp = 0; grp < GroupCount; grp++) {
951
-    if (grp == curGroup)
952
-      continue;
919
+    if (grp == curGroup) continue;
953 920
 
954 921
     for (int page = 0; page < PagesPerGroup; page++) {
955 922
       if (!ee_IsPageClean(grp * PagesPerGroup + page)) {
@@ -1031,4 +998,4 @@ void eeprom_flush(void) {
1031 998
 }
1032 999
 
1033 1000
 #endif // ENABLED(EEPROM_SETTINGS) && DISABLED(I2C_EEPROM) && DISABLED(SPI_EEPROM)
1034
-#endif // ARDUINO_ARCH_AVR
1001
+#endif // ARDUINO_ARCH_AVR

+ 2
- 2
Marlin/src/gcode/feature/trinamic/M911-M915.cpp Visa fil

@@ -161,8 +161,8 @@ void GcodeSuite::M912() {
161 161
   void GcodeSuite::M913() {
162 162
     #define TMC_SAY_PWMTHRS(A,Q) tmc_get_pwmthrs(stepper##Q, TMC_##Q, planner.axis_steps_per_mm[_AXIS(A)])
163 163
     #define TMC_SET_PWMTHRS(A,Q) tmc_set_pwmthrs(stepper##Q, value, planner.axis_steps_per_mm[_AXIS(A)])
164
-    #define TMC_SAY_PWMTHRS_E(E) do{ const uint8_t extruder = E; tmc_get_pwmthrs(stepperE##E, TMC_E##E, planner.axis_steps_per_mm[E_AXIS_N]); }while(0)
165
-    #define TMC_SET_PWMTHRS_E(E) do{ const uint8_t extruder = E; tmc_set_pwmthrs(stepperE##E, value, planner.axis_steps_per_mm[E_AXIS_N]); }while(0)
164
+    #define TMC_SAY_PWMTHRS_E(E) do{ constexpr uint8_t extruder = E; tmc_get_pwmthrs(stepperE##E, TMC_E##E, planner.axis_steps_per_mm[E_AXIS_N]); UNUSED(extruder); }while(0)
165
+    #define TMC_SET_PWMTHRS_E(E) do{ constexpr uint8_t extruder = E; tmc_set_pwmthrs(stepperE##E, value, planner.axis_steps_per_mm[E_AXIS_N]); UNUSED(extruder); }while(0)
166 166
 
167 167
     bool report = true;
168 168
     const uint8_t index = parser.byteval('I');

+ 10
- 4
Marlin/src/module/stepper_indirection.cpp Visa fil

@@ -258,16 +258,19 @@
258 258
       _TMC2130_INIT(E0, planner.axis_steps_per_mm[E_AXIS]);
259 259
     #endif
260 260
     #if AXIS_DRIVER_TYPE(E1, TMC2130)
261
-      { constexpr int extruder = 1; _TMC2130_INIT(E1, planner.axis_steps_per_mm[E_AXIS_N]); }
261
+      { constexpr uint8_t extruder = 1; _TMC2130_INIT(E1, planner.axis_steps_per_mm[E_AXIS_N]); UNUSED(extruder); }
262 262
     #endif
263 263
     #if AXIS_DRIVER_TYPE(E2, TMC2130)
264
-      { constexpr int extruder = 2; _TMC2130_INIT(E2, planner.axis_steps_per_mm[E_AXIS_N]); }
264
+      { constexpr uint8_t extruder = 2; _TMC2130_INIT(E2, planner.axis_steps_per_mm[E_AXIS_N]); UNUSED(extruder); }
265 265
     #endif
266 266
     #if AXIS_DRIVER_TYPE(E3, TMC2130)
267
-      { constexpr int extruder = 3; _TMC2130_INIT(E3, planner.axis_steps_per_mm[E_AXIS_N]); }
267
+      { constexpr uint8_t extruder = 3; _TMC2130_INIT(E3, planner.axis_steps_per_mm[E_AXIS_N]); UNUSED(extruder); }
268 268
     #endif
269 269
     #if AXIS_DRIVER_TYPE(E4, TMC2130)
270
-      { constexpr int extruder = 4; _TMC2130_INIT(E4, planner.axis_steps_per_mm[E_AXIS_N]); }
270
+      { constexpr uint8_t extruder = 4; _TMC2130_INIT(E4, planner.axis_steps_per_mm[E_AXIS_N]); UNUSED(extruder); }
271
+    #endif
272
+    #if AXIS_DRIVER_TYPE(E5, TMC2130)
273
+      { constexpr uint8_t extruder = 5; _TMC2130_INIT(E5, planner.axis_steps_per_mm[E_AXIS_N]); UNUSED(extruder); }
271 274
     #endif
272 275
 
273 276
     #if ENABLED(SENSORLESS_HOMING)
@@ -580,6 +583,9 @@
580 583
     #if AXIS_DRIVER_TYPE(E4, TMC2208)
581 584
       { constexpr int extruder = 4; _TMC2208_INIT(E4, planner.axis_steps_per_mm[E_AXIS_N]); }
582 585
     #endif
586
+    #if AXIS_DRIVER_TYPE(E5, TMC2208)
587
+      { constexpr int extruder = 5; _TMC2208_INIT(E5, planner.axis_steps_per_mm[E_AXIS_N]); }
588
+    #endif
583 589
   }
584 590
 #endif // TMC2208
585 591
 

Laddar…
Avbryt
Spara