ソースを参照

Merge pull request #7471 from thinkyhead/bf1_cleanups_aug9

Miscellaneous style tweaks
Scott Lahteine 7年前
コミット
6172f150c2

+ 9
- 11
Marlin/Conditionals_post.h ファイルの表示

@@ -681,16 +681,6 @@
681 681
   #endif
682 682
   #define WRITE_FAN_N(n, v) WRITE_FAN##n(v)
683 683
 
684
-
685
-  /**
686
-   * Heater & Fan Pausing
687
-   */
688
-  #if FAN_COUNT == 0
689
-    #undef PROBING_FANS_OFF
690
-  #endif
691
-  #define QUIET_PROBING (HAS_BED_PROBE && (ENABLED(PROBING_HEATERS_OFF) || ENABLED(PROBING_FANS_OFF) || DELAY_BEFORE_PROBING > 0))
692
-  #define HEATER_IDLE_HANDLER (ENABLED(ADVANCED_PAUSE_FEATURE) || ENABLED(PROBING_HEATERS_OFF))
693
-
694 684
   /**
695 685
    * Servos and probes
696 686
    */
@@ -702,7 +692,6 @@
702 692
   #endif
703 693
 
704 694
   #define PROBE_PIN_CONFIGURED (HAS_Z_MIN_PROBE_PIN || (HAS_Z_MIN && ENABLED(Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN)))
705
-
706 695
   #define HAS_BED_PROBE (PROBE_SELECTED && PROBE_PIN_CONFIGURED && DISABLED(PROBE_MANUALLY))
707 696
 
708 697
   #if ENABLED(Z_PROBE_ALLEN_KEY)
@@ -744,6 +733,15 @@
744 733
   #endif
745 734
 
746 735
   /**
736
+   * Heater & Fan Pausing
737
+   */
738
+  #if FAN_COUNT == 0
739
+    #undef PROBING_FANS_OFF
740
+  #endif
741
+  #define QUIET_PROBING (HAS_BED_PROBE && (ENABLED(PROBING_HEATERS_OFF) || ENABLED(PROBING_FANS_OFF) || DELAY_BEFORE_PROBING > 0))
742
+  #define HEATER_IDLE_HANDLER (ENABLED(ADVANCED_PAUSE_FEATURE) || ENABLED(PROBING_HEATERS_OFF))
743
+
744
+  /**
747 745
    * Delta radius/rod trimmers/angle trimmers
748 746
    */
749 747
   #if ENABLED(DELTA)

+ 5
- 4
Marlin/Marlin_main.cpp ファイルの表示

@@ -2359,10 +2359,11 @@ static void clean_up_after_endstop_or_probe_move() {
2359 2359
 
2360 2360
     const float nx = lx - (X_PROBE_OFFSET_FROM_EXTRUDER), ny = ly - (Y_PROBE_OFFSET_FROM_EXTRUDER);
2361 2361
 
2362
-    if (printable) {
2363
-      if (!position_is_reachable_by_probe_xy(lx, ly)) return NAN;
2364
-    }
2365
-    else if (!position_is_reachable_xy(nx, ny)) return NAN;
2362
+    if (printable
2363
+      ? !position_is_reachable_xy(nx, ny)
2364
+      : !position_is_reachable_by_probe_xy(lx, ly)
2365
+    ) return NAN;
2366
+
2366 2367
 
2367 2368
     const float old_feedrate_mm_s = feedrate_mm_s;
2368 2369
 

+ 52
- 52
Marlin/Sd2Card.cpp ファイルの表示

@@ -55,7 +55,7 @@
55 55
   //------------------------------------------------------------------------------
56 56
   /** SPI receive a byte */
57 57
   static uint8_t spiRec() {
58
-    SPDR = 0XFF;
58
+    SPDR = 0xFF;
59 59
     while (!TEST(SPSR, SPIF)) { /* Intentionally left empty */ }
60 60
     return SPDR;
61 61
   }
@@ -64,11 +64,11 @@
64 64
   static inline __attribute__((always_inline))
65 65
   void spiRead(uint8_t* buf, uint16_t nbyte) {
66 66
     if (nbyte-- == 0) return;
67
-    SPDR = 0XFF;
67
+    SPDR = 0xFF;
68 68
     for (uint16_t i = 0; i < nbyte; i++) {
69 69
       while (!TEST(SPSR, SPIF)) { /* Intentionally left empty */ }
70 70
       buf[i] = SPDR;
71
-      SPDR = 0XFF;
71
+      SPDR = 0xFF;
72 72
     }
73 73
     while (!TEST(SPSR, SPIF)) { /* Intentionally left empty */ }
74 74
     buf[nbyte] = SPDR;
@@ -103,7 +103,7 @@
103 103
     uint8_t data = 0;
104 104
     // no interrupts during byte receive - about 8 us
105 105
     cli();
106
-    // output pin high - like sending 0XFF
106
+    // output pin high - like sending 0xFF
107 107
     WRITE(SPI_MOSI_PIN, HIGH);
108 108
 
109 109
     for (uint8_t i = 0; i < 8; i++) {
@@ -137,7 +137,7 @@
137 137
     for (uint8_t i = 0; i < 8; i++) {
138 138
       WRITE(SPI_SCK_PIN, LOW);
139 139
 
140
-      WRITE(SPI_MOSI_PIN, data & 0X80);
140
+      WRITE(SPI_MOSI_PIN, data & 0x80);
141 141
 
142 142
       data <<= 1;
143 143
 
@@ -177,16 +177,16 @@ uint8_t Sd2Card::cardCommand(uint8_t cmd, uint32_t arg) {
177 177
   for (int8_t s = 24; s >= 0; s -= 8) spiSend(arg >> s);
178 178
 
179 179
   // send CRC
180
-  uint8_t crc = 0XFF;
181
-  if (cmd == CMD0) crc = 0X95;  // correct crc for CMD0 with arg 0
182
-  if (cmd == CMD8) crc = 0X87;  // correct crc for CMD8 with arg 0X1AA
180
+  uint8_t crc = 0xFF;
181
+  if (cmd == CMD0) crc = 0x95;  // correct crc for CMD0 with arg 0
182
+  if (cmd == CMD8) crc = 0x87;  // correct crc for CMD8 with arg 0x1AA
183 183
   spiSend(crc);
184 184
 
185 185
   // skip stuff byte for stop read
186 186
   if (cmd == CMD12) spiRec();
187 187
 
188 188
   // wait for response
189
-  for (uint8_t i = 0; ((status_ = spiRec()) & 0X80) && i != 0XFF; i++) { /* Intentionally left empty */ }
189
+  for (uint8_t i = 0; ((status_ = spiRec()) & 0x80) && i != 0xFF; i++) { /* Intentionally left empty */ }
190 190
   return status_;
191 191
 }
192 192
 //------------------------------------------------------------------------------
@@ -244,7 +244,7 @@ void Sd2Card::chipSelectLow() {
244 244
  */
245 245
 bool Sd2Card::erase(uint32_t firstBlock, uint32_t lastBlock) {
246 246
   csd_t csd;
247
-  if (!readCSD(&csd)) goto fail;
247
+  if (!readCSD(&csd)) goto FAIL;
248 248
   // check for single block erase
249 249
   if (!csd.v1.erase_blk_en) {
250 250
     // erase size mask
@@ -252,7 +252,7 @@ bool Sd2Card::erase(uint32_t firstBlock, uint32_t lastBlock) {
252 252
     if ((firstBlock & m) != 0 || ((lastBlock + 1) & m) != 0) {
253 253
       // error card can't erase specified area
254 254
       error(SD_CARD_ERROR_ERASE_SINGLE_BLOCK);
255
-      goto fail;
255
+      goto FAIL;
256 256
     }
257 257
   }
258 258
   if (type_ != SD_CARD_TYPE_SDHC) {
@@ -263,15 +263,15 @@ bool Sd2Card::erase(uint32_t firstBlock, uint32_t lastBlock) {
263 263
       || cardCommand(CMD33, lastBlock)
264 264
       || cardCommand(CMD38, 0)) {
265 265
     error(SD_CARD_ERROR_ERASE);
266
-    goto fail;
266
+    goto FAIL;
267 267
   }
268 268
   if (!waitNotBusy(SD_ERASE_TIMEOUT)) {
269 269
     error(SD_CARD_ERROR_ERASE_TIMEOUT);
270
-    goto fail;
270
+    goto FAIL;
271 271
   }
272 272
   chipSelectHigh();
273 273
   return true;
274
-fail:
274
+  FAIL:
275 275
   chipSelectHigh();
276 276
   return false;
277 277
 }
@@ -329,13 +329,13 @@ bool Sd2Card::init(uint8_t sckRateID, uint8_t chipSelectPin) {
329 329
   #endif  // SOFTWARE_SPI
330 330
 
331 331
   // must supply min of 74 clock cycles with CS high.
332
-  for (uint8_t i = 0; i < 10; i++) spiSend(0XFF);
332
+  for (uint8_t i = 0; i < 10; i++) spiSend(0xFF);
333 333
 
334 334
   // command to go idle in SPI mode
335 335
   while ((status_ = cardCommand(CMD0, 0)) != R1_IDLE_STATE) {
336 336
     if (((uint16_t)millis() - t0) > SD_INIT_TIMEOUT) {
337 337
       error(SD_CARD_ERROR_CMD0);
338
-      goto fail;
338
+      goto FAIL;
339 339
     }
340 340
   }
341 341
   // check SD version
@@ -345,29 +345,29 @@ bool Sd2Card::init(uint8_t sckRateID, uint8_t chipSelectPin) {
345 345
   else {
346 346
     // only need last byte of r7 response
347 347
     for (uint8_t i = 0; i < 4; i++) status_ = spiRec();
348
-    if (status_ != 0XAA) {
348
+    if (status_ != 0xAA) {
349 349
       error(SD_CARD_ERROR_CMD8);
350
-      goto fail;
350
+      goto FAIL;
351 351
     }
352 352
     type(SD_CARD_TYPE_SD2);
353 353
   }
354 354
   // initialize card and send host supports SDHC if SD2
355
-  arg = type() == SD_CARD_TYPE_SD2 ? 0X40000000 : 0;
355
+  arg = type() == SD_CARD_TYPE_SD2 ? 0x40000000 : 0;
356 356
 
357 357
   while ((status_ = cardAcmd(ACMD41, arg)) != R1_READY_STATE) {
358 358
     // check for timeout
359 359
     if (((uint16_t)millis() - t0) > SD_INIT_TIMEOUT) {
360 360
       error(SD_CARD_ERROR_ACMD41);
361
-      goto fail;
361
+      goto FAIL;
362 362
     }
363 363
   }
364 364
   // if SD2 read OCR register to check for SDHC card
365 365
   if (type() == SD_CARD_TYPE_SD2) {
366 366
     if (cardCommand(CMD58, 0)) {
367 367
       error(SD_CARD_ERROR_CMD58);
368
-      goto fail;
368
+      goto FAIL;
369 369
     }
370
-    if ((spiRec() & 0XC0) == 0XC0) type(SD_CARD_TYPE_SDHC);
370
+    if ((spiRec() & 0xC0) == 0xC0) type(SD_CARD_TYPE_SDHC);
371 371
     // discard rest of ocr - contains allowed voltage range
372 372
     for (uint8_t i = 0; i < 3; i++) spiRec();
373 373
   }
@@ -380,7 +380,7 @@ bool Sd2Card::init(uint8_t sckRateID, uint8_t chipSelectPin) {
380 380
     return true;
381 381
   #endif  // SOFTWARE_SPI
382 382
 
383
-fail:
383
+  FAIL:
384 384
   chipSelectHigh();
385 385
   return false;
386 386
 }
@@ -473,7 +473,7 @@ static const uint16_t crctab[] PROGMEM = {
473 473
 static uint16_t CRC_CCITT(const uint8_t* data, size_t n) {
474 474
   uint16_t crc = 0;
475 475
   for (size_t i = 0; i < n; i++) {
476
-    crc = pgm_read_word(&crctab[(crc >> 8 ^ data[i]) & 0XFF]) ^ (crc << 8);
476
+    crc = pgm_read_word(&crctab[(crc >> 8 ^ data[i]) & 0xFF]) ^ (crc << 8);
477 477
   }
478 478
   return crc;
479 479
 }
@@ -486,12 +486,12 @@ bool Sd2Card::readData(uint8_t* dst, uint16_t count) {
486 486
   while ((status_ = spiRec()) == 0XFF) {
487 487
     if (((uint16_t)millis() - t0) > SD_READ_TIMEOUT) {
488 488
       error(SD_CARD_ERROR_READ_TIMEOUT);
489
-      goto fail;
489
+      goto FAIL;
490 490
     }
491 491
   }
492 492
   if (status_ != DATA_START_BLOCK) {
493 493
     error(SD_CARD_ERROR_READ);
494
-    goto fail;
494
+    goto FAIL;
495 495
   }
496 496
   // transfer data
497 497
   spiRead(dst, count);
@@ -503,7 +503,7 @@ bool Sd2Card::readData(uint8_t* dst, uint16_t count) {
503 503
     recvCrc |= spiRec();
504 504
     if (calcCrc != recvCrc) {
505 505
       error(SD_CARD_ERROR_CRC);
506
-      goto fail;
506
+      goto FAIL;
507 507
     }
508 508
   }
509 509
 #else
@@ -515,7 +515,7 @@ bool Sd2Card::readData(uint8_t* dst, uint16_t count) {
515 515
   // Send an additional dummy byte, required by Toshiba Flash Air SD Card
516 516
   spiSend(0XFF);
517 517
   return true;
518
-fail:
518
+  FAIL:
519 519
   chipSelectHigh();
520 520
   // Send an additional dummy byte, required by Toshiba Flash Air SD Card
521 521
   spiSend(0XFF);
@@ -527,10 +527,10 @@ bool Sd2Card::readRegister(uint8_t cmd, void* buf) {
527 527
   uint8_t* dst = reinterpret_cast<uint8_t*>(buf);
528 528
   if (cardCommand(cmd, 0)) {
529 529
     error(SD_CARD_ERROR_READ_REG);
530
-    goto fail;
530
+    goto FAIL;
531 531
   }
532 532
   return readData(dst, 16);
533
-fail:
533
+  FAIL:
534 534
   chipSelectHigh();
535 535
   return false;
536 536
 }
@@ -549,11 +549,11 @@ bool Sd2Card::readStart(uint32_t blockNumber) {
549 549
   if (type() != SD_CARD_TYPE_SDHC) blockNumber <<= 9;
550 550
   if (cardCommand(CMD18, blockNumber)) {
551 551
     error(SD_CARD_ERROR_CMD18);
552
-    goto fail;
552
+    goto FAIL;
553 553
   }
554 554
   chipSelectHigh();
555 555
   return true;
556
-fail:
556
+  FAIL:
557 557
   chipSelectHigh();
558 558
   return false;
559 559
 }
@@ -567,11 +567,11 @@ bool Sd2Card::readStop() {
567 567
   chipSelectLow();
568 568
   if (cardCommand(CMD12, 0)) {
569 569
     error(SD_CARD_ERROR_CMD12);
570
-    goto fail;
570
+    goto FAIL;
571 571
   }
572 572
   chipSelectHigh();
573 573
   return true;
574
-fail:
574
+  FAIL:
575 575
   chipSelectHigh();
576 576
   return false;
577 577
 }
@@ -601,10 +601,10 @@ bool Sd2Card::setSckRate(uint8_t sckRateID) {
601 601
 bool Sd2Card::waitNotBusy(uint16_t timeoutMillis) {
602 602
   uint16_t t0 = millis();
603 603
   while (spiRec() != 0XFF) {
604
-    if (((uint16_t)millis() - t0) >= timeoutMillis) goto fail;
604
+    if (((uint16_t)millis() - t0) >= timeoutMillis) goto FAIL;
605 605
   }
606 606
   return true;
607
-fail:
607
+  FAIL:
608 608
   return false;
609 609
 }
610 610
 //------------------------------------------------------------------------------
@@ -621,23 +621,23 @@ bool Sd2Card::writeBlock(uint32_t blockNumber, const uint8_t* src) {
621 621
   if (type() != SD_CARD_TYPE_SDHC) blockNumber <<= 9;
622 622
   if (cardCommand(CMD24, blockNumber)) {
623 623
     error(SD_CARD_ERROR_CMD24);
624
-    goto fail;
624
+    goto FAIL;
625 625
   }
626
-  if (!writeData(DATA_START_BLOCK, src)) goto fail;
626
+  if (!writeData(DATA_START_BLOCK, src)) goto FAIL;
627 627
 
628 628
   // wait for flash programming to complete
629 629
   if (!waitNotBusy(SD_WRITE_TIMEOUT)) {
630 630
     error(SD_CARD_ERROR_WRITE_TIMEOUT);
631
-    goto fail;
631
+    goto FAIL;
632 632
   }
633 633
   // response is r2 so get and check two bytes for nonzero
634 634
   if (cardCommand(CMD13, 0) || spiRec()) {
635 635
     error(SD_CARD_ERROR_WRITE_PROGRAMMING);
636
-    goto fail;
636
+    goto FAIL;
637 637
   }
638 638
   chipSelectHigh();
639 639
   return true;
640
-fail:
640
+  FAIL:
641 641
   chipSelectHigh();
642 642
   return false;
643 643
 }
@@ -650,11 +650,11 @@ fail:
650 650
 bool Sd2Card::writeData(const uint8_t* src) {
651 651
   chipSelectLow();
652 652
   // wait for previous write to finish
653
-  if (!waitNotBusy(SD_WRITE_TIMEOUT)) goto fail;
654
-  if (!writeData(WRITE_MULTIPLE_TOKEN, src)) goto fail;
653
+  if (!waitNotBusy(SD_WRITE_TIMEOUT)) goto FAIL;
654
+  if (!writeData(WRITE_MULTIPLE_TOKEN, src)) goto FAIL;
655 655
   chipSelectHigh();
656 656
   return true;
657
-fail:
657
+  FAIL:
658 658
   error(SD_CARD_ERROR_WRITE_MULTIPLE);
659 659
   chipSelectHigh();
660 660
   return false;
@@ -670,10 +670,10 @@ bool Sd2Card::writeData(uint8_t token, const uint8_t* src) {
670 670
   status_ = spiRec();
671 671
   if ((status_ & DATA_RES_MASK) != DATA_RES_ACCEPTED) {
672 672
     error(SD_CARD_ERROR_WRITE);
673
-    goto fail;
673
+    goto FAIL;
674 674
   }
675 675
   return true;
676
-fail:
676
+  FAIL:
677 677
   chipSelectHigh();
678 678
   return false;
679 679
 }
@@ -693,17 +693,17 @@ bool Sd2Card::writeStart(uint32_t blockNumber, uint32_t eraseCount) {
693 693
   // send pre-erase count
694 694
   if (cardAcmd(ACMD23, eraseCount)) {
695 695
     error(SD_CARD_ERROR_ACMD23);
696
-    goto fail;
696
+    goto FAIL;
697 697
   }
698 698
   // use address if not SDHC card
699 699
   if (type() != SD_CARD_TYPE_SDHC) blockNumber <<= 9;
700 700
   if (cardCommand(CMD25, blockNumber)) {
701 701
     error(SD_CARD_ERROR_CMD25);
702
-    goto fail;
702
+    goto FAIL;
703 703
   }
704 704
   chipSelectHigh();
705 705
   return true;
706
-fail:
706
+  FAIL:
707 707
   chipSelectHigh();
708 708
   return false;
709 709
 }
@@ -715,12 +715,12 @@ fail:
715 715
  */
716 716
 bool Sd2Card::writeStop() {
717 717
   chipSelectLow();
718
-  if (!waitNotBusy(SD_WRITE_TIMEOUT)) goto fail;
718
+  if (!waitNotBusy(SD_WRITE_TIMEOUT)) goto FAIL;
719 719
   spiSend(STOP_TRAN_TOKEN);
720
-  if (!waitNotBusy(SD_WRITE_TIMEOUT)) goto fail;
720
+  if (!waitNotBusy(SD_WRITE_TIMEOUT)) goto FAIL;
721 721
   chipSelectHigh();
722 722
   return true;
723
-fail:
723
+  FAIL:
724 724
   error(SD_CARD_ERROR_STOP_TRAN);
725 725
   chipSelectHigh();
726 726
   return false;

+ 11
- 11
Marlin/Sd2Card.h ファイルの表示

@@ -92,27 +92,27 @@ uint8_t const SD_CARD_ERROR_ERASE_TIMEOUT = 0XE;
92 92
 /** card returned an error token instead of read data */
93 93
 uint8_t const SD_CARD_ERROR_READ = 0XF;
94 94
 /** read CID or CSD failed */
95
-uint8_t const SD_CARD_ERROR_READ_REG = 0X10;
95
+uint8_t const SD_CARD_ERROR_READ_REG = 0x10;
96 96
 /** timeout while waiting for start of read data */
97
-uint8_t const SD_CARD_ERROR_READ_TIMEOUT = 0X11;
97
+uint8_t const SD_CARD_ERROR_READ_TIMEOUT = 0x11;
98 98
 /** card did not accept STOP_TRAN_TOKEN */
99
-uint8_t const SD_CARD_ERROR_STOP_TRAN = 0X12;
99
+uint8_t const SD_CARD_ERROR_STOP_TRAN = 0x12;
100 100
 /** card returned an error token as a response to a write operation */
101
-uint8_t const SD_CARD_ERROR_WRITE = 0X13;
101
+uint8_t const SD_CARD_ERROR_WRITE = 0x13;
102 102
 /** attempt to write protected block zero */
103
-uint8_t const SD_CARD_ERROR_WRITE_BLOCK_ZERO = 0X14;  // REMOVE - not used
103
+uint8_t const SD_CARD_ERROR_WRITE_BLOCK_ZERO = 0x14;  // REMOVE - not used
104 104
 /** card did not go ready for a multiple block write */
105
-uint8_t const SD_CARD_ERROR_WRITE_MULTIPLE = 0X15;
105
+uint8_t const SD_CARD_ERROR_WRITE_MULTIPLE = 0x15;
106 106
 /** card returned an error to a CMD13 status check after a write */
107
-uint8_t const SD_CARD_ERROR_WRITE_PROGRAMMING = 0X16;
107
+uint8_t const SD_CARD_ERROR_WRITE_PROGRAMMING = 0x16;
108 108
 /** timeout occurred during write programming */
109
-uint8_t const SD_CARD_ERROR_WRITE_TIMEOUT = 0X17;
109
+uint8_t const SD_CARD_ERROR_WRITE_TIMEOUT = 0x17;
110 110
 /** incorrect rate selected */
111
-uint8_t const SD_CARD_ERROR_SCK_RATE = 0X18;
111
+uint8_t const SD_CARD_ERROR_SCK_RATE = 0x18;
112 112
 /** init() not called */
113
-uint8_t const SD_CARD_ERROR_INIT_NOT_CALLED = 0X19;
113
+uint8_t const SD_CARD_ERROR_INIT_NOT_CALLED = 0x19;
114 114
 /** crc check error */
115
-uint8_t const SD_CARD_ERROR_CRC = 0X20;
115
+uint8_t const SD_CARD_ERROR_CRC = 0x20;
116 116
 //------------------------------------------------------------------------------
117 117
 // card types
118 118
 /** Standard capacity V1 SD card */

+ 150
- 150
Marlin/SdBaseFile.cpp
ファイル差分が大きすぎるため省略します
ファイルの表示


+ 13
- 13
Marlin/SdBaseFile.h ファイルの表示

@@ -54,11 +54,11 @@ struct filepos_t {
54 54
 
55 55
 // use the gnu style oflag in open()
56 56
 /** open() oflag for reading */
57
-uint8_t const O_READ = 0X01;
57
+uint8_t const O_READ = 0x01;
58 58
 /** open() oflag - same as O_IN */
59 59
 uint8_t const O_RDONLY = O_READ;
60 60
 /** open() oflag for write */
61
-uint8_t const O_WRITE = 0X02;
61
+uint8_t const O_WRITE = 0x02;
62 62
 /** open() oflag - same as O_WRITE */
63 63
 uint8_t const O_WRONLY = O_WRITE;
64 64
 /** open() oflag for reading and writing */
@@ -66,17 +66,17 @@ uint8_t const O_RDWR = (O_READ | O_WRITE);
66 66
 /** open() oflag mask for access modes */
67 67
 uint8_t const O_ACCMODE = (O_READ | O_WRITE);
68 68
 /** The file offset shall be set to the end of the file prior to each write. */
69
-uint8_t const O_APPEND = 0X04;
69
+uint8_t const O_APPEND = 0x04;
70 70
 /** synchronous writes - call sync() after each write */
71
-uint8_t const O_SYNC = 0X08;
71
+uint8_t const O_SYNC = 0x08;
72 72
 /** truncate the file to zero length */
73
-uint8_t const O_TRUNC = 0X10;
73
+uint8_t const O_TRUNC = 0x10;
74 74
 /** set the initial position at the end of the file */
75
-uint8_t const O_AT_END = 0X20;
75
+uint8_t const O_AT_END = 0x20;
76 76
 /** create the file if nonexistent */
77
-uint8_t const O_CREAT = 0X40;
77
+uint8_t const O_CREAT = 0x40;
78 78
 /** If O_CREAT and O_EXCL are set, open() shall fail if the file exists */
79
-uint8_t const O_EXCL = 0X80;
79
+uint8_t const O_EXCL = 0x80;
80 80
 
81 81
 // SdBaseFile class static and const definitions
82 82
 // flags for ls()
@@ -141,7 +141,7 @@ static inline uint8_t FAT_MONTH(uint16_t fatDate) {
141 141
  * \return Extracted day [1,31]
142 142
  */
143 143
 static inline uint8_t FAT_DAY(uint16_t fatDate) {
144
-  return fatDate & 0X1F;
144
+  return fatDate & 0x1F;
145 145
 }
146 146
 /** time field for FAT directory entry
147 147
  * \param[in] hour [0,23]
@@ -167,7 +167,7 @@ static inline uint8_t FAT_HOUR(uint16_t fatTime) {
167 167
  * \return Extracted minute [0,59]
168 168
  */
169 169
 static inline uint8_t FAT_MINUTE(uint16_t fatTime) {
170
-  return (fatTime >> 5) & 0X3F;
170
+  return (fatTime >> 5) & 0x3F;
171 171
 }
172 172
 /** second part of FAT directory time field
173 173
  * Note second/2 is stored in packed time.
@@ -177,7 +177,7 @@ static inline uint8_t FAT_MINUTE(uint16_t fatTime) {
177 177
  * \return Extracted second [0,58]
178 178
  */
179 179
 static inline uint8_t FAT_SECOND(uint16_t fatTime) {
180
-  return 2 * (fatTime & 0X1F);
180
+  return 2 * (fatTime & 0x1F);
181 181
 }
182 182
 /** Default date for file timestamps is 1 Jan 2000 */
183 183
 uint16_t const FAT_DEFAULT_DATE = ((2000 - 1980) << 9) | (1 << 5) | 1;
@@ -338,10 +338,10 @@ class SdBaseFile {
338 338
   // data time callback function
339 339
   static void (*dateTime_)(uint16_t* date, uint16_t* time);
340 340
   // bits defined in flags_
341
-  // should be 0X0F
341
+  // should be 0x0F
342 342
   static uint8_t const F_OFLAG = (O_ACCMODE | O_APPEND | O_SYNC);
343 343
   // sync of directory entry required
344
-  static uint8_t const F_FILE_DIR_DIRTY = 0X80;
344
+  static uint8_t const F_FILE_DIR_DIRTY = 0x80;
345 345
 
346 346
   // private data
347 347
   uint8_t   flags_;         // See above for definition of flags_ bits

+ 36
- 36
Marlin/SdFatStructs.h ファイルの表示

@@ -43,11 +43,11 @@
43 43
  */
44 44
 //------------------------------------------------------------------------------
45 45
 /** Value for byte 510 of boot block or MBR */
46
-uint8_t const BOOTSIG0 = 0X55;
46
+uint8_t const BOOTSIG0 = 0x55;
47 47
 /** Value for byte 511 of boot block or MBR */
48
-uint8_t const BOOTSIG1 = 0XAA;
48
+uint8_t const BOOTSIG1 = 0xAA;
49 49
 /** Value for bootSignature field int FAT/FAT32 boot sector */
50
-uint8_t const EXTENDED_BOOT_SIG = 0X29;
50
+uint8_t const EXTENDED_BOOT_SIG = 0x29;
51 51
 //------------------------------------------------------------------------------
52 52
 /**
53 53
  * \struct partitionTable
@@ -59,8 +59,8 @@ uint8_t const EXTENDED_BOOT_SIG = 0X29;
59 59
 struct partitionTable {
60 60
           /**
61 61
            * Boot Indicator . Indicates whether the volume is the active
62
-           * partition.  Legal values include: 0X00. Do not use for booting.
63
-           * 0X80 Active partition.
62
+           * partition.  Legal values include: 0x00. Do not use for booting.
63
+           * 0x80 Active partition.
64 64
            */
65 65
   uint8_t  boot;
66 66
           /**
@@ -126,9 +126,9 @@ struct masterBootRecord {
126 126
   uint16_t usuallyZero;
127 127
            /** Partition tables. */
128 128
   part_t   part[4];
129
-           /** First MBR signature byte. Must be 0X55 */
129
+           /** First MBR signature byte. Must be 0x55 */
130 130
   uint8_t  mbrSig0;
131
-           /** Second MBR signature byte. Must be 0XAA */
131
+           /** Second MBR signature byte. Must be 0xAA */
132 132
   uint8_t  mbrSig1;
133 133
 } PACKED;
134 134
 /** Type name for masterBootRecord */
@@ -234,7 +234,7 @@ struct fat_boot {
234 234
   uint8_t  driveNumber;
235 235
            /** used by Windows NT - should be zero for FAT */
236 236
   uint8_t  reserved1;
237
-           /** 0X29 if next three fields are valid */
237
+           /** 0x29 if next three fields are valid */
238 238
   uint8_t  bootSignature;
239 239
            /**
240 240
             * A random serial number created when formatting a disk,
@@ -254,9 +254,9 @@ struct fat_boot {
254 254
   char     fileSystemType[8];
255 255
            /** X86 boot code */
256 256
   uint8_t  bootCode[448];
257
-           /** must be 0X55 */
257
+           /** must be 0x55 */
258 258
   uint8_t  bootSectorSig0;
259
-           /** must be 0XAA */
259
+           /** must be 0xAA */
260 260
   uint8_t  bootSectorSig1;
261 261
 } PACKED;
262 262
 /** Type name for FAT Boot Sector */
@@ -389,7 +389,7 @@ struct fat32_boot {
389 389
   uint8_t  driveNumber;
390 390
            /** used by Windows NT - should be zero for FAT */
391 391
   uint8_t  reserved1;
392
-           /** 0X29 if next three fields are valid */
392
+           /** 0x29 if next three fields are valid */
393 393
   uint8_t  bootSignature;
394 394
            /**
395 395
             * A random serial number created when formatting a disk,
@@ -408,9 +408,9 @@ struct fat32_boot {
408 408
   char     fileSystemType[8];
409 409
            /** X86 boot code */
410 410
   uint8_t  bootCode[420];
411
-           /** must be 0X55 */
411
+           /** must be 0x55 */
412 412
   uint8_t  bootSectorSig0;
413
-           /** must be 0XAA */
413
+           /** must be 0xAA */
414 414
   uint8_t  bootSectorSig1;
415 415
 } PACKED;
416 416
 /** Type name for FAT32 Boot Sector */
@@ -427,11 +427,11 @@ uint32_t const FSINFO_STRUCT_SIG = 0x61417272;
427 427
  *
428 428
  */
429 429
 struct fat32_fsinfo {
430
-           /** must be 0X52, 0X52, 0X61, 0X41 */
430
+           /** must be 0x52, 0x52, 0x61, 0x41 */
431 431
   uint32_t  leadSignature;
432 432
            /** must be zero */
433 433
   uint8_t  reserved1[480];
434
-           /** must be 0X72, 0X72, 0X41, 0X61 */
434
+           /** must be 0x72, 0x72, 0x41, 0x61 */
435 435
   uint32_t  structSignature;
436 436
           /**
437 437
            * Contains the last known free cluster count on the volume.
@@ -450,7 +450,7 @@ struct fat32_fsinfo {
450 450
   uint32_t nextFree;
451 451
            /** must be zero */
452 452
   uint8_t  reserved2[12];
453
-           /** must be 0X00, 0X00, 0X55, 0XAA */
453
+           /** must be 0x00, 0x00, 0x55, 0xAA */
454 454
   uint8_t  tailSignature[4];
455 455
 } PACKED;
456 456
 /** Type name for FAT32 FSINFO Sector */
@@ -458,19 +458,19 @@ typedef struct fat32_fsinfo fat32_fsinfo_t;
458 458
 //------------------------------------------------------------------------------
459 459
 // End Of Chain values for FAT entries
460 460
 /** FAT12 end of chain value used by Microsoft. */
461
-uint16_t const FAT12EOC = 0XFFF;
461
+uint16_t const FAT12EOC = 0xFFF;
462 462
 /** Minimum value for FAT12 EOC.  Use to test for EOC. */
463
-uint16_t const FAT12EOC_MIN = 0XFF8;
463
+uint16_t const FAT12EOC_MIN = 0xFF8;
464 464
 /** FAT16 end of chain value used by Microsoft. */
465
-uint16_t const FAT16EOC = 0XFFFF;
465
+uint16_t const FAT16EOC = 0xFFFF;
466 466
 /** Minimum value for FAT16 EOC.  Use to test for EOC. */
467
-uint16_t const FAT16EOC_MIN = 0XFFF8;
467
+uint16_t const FAT16EOC_MIN = 0xFFF8;
468 468
 /** FAT32 end of chain value used by Microsoft. */
469
-uint32_t const FAT32EOC = 0X0FFFFFFF;
469
+uint32_t const FAT32EOC = 0x0FFFFFFF;
470 470
 /** Minimum value for FAT32 EOC.  Use to test for EOC. */
471
-uint32_t const FAT32EOC_MIN = 0X0FFFFFF8;
471
+uint32_t const FAT32EOC_MIN = 0x0FFFFFF8;
472 472
 /** Mask a for FAT32 entry. Entries are 28 bits. */
473
-uint32_t const FAT32MASK = 0X0FFFFFFF;
473
+uint32_t const FAT32MASK = 0x0FFFFFFF;
474 474
 //------------------------------------------------------------------------------
475 475
 /**
476 476
  * \struct directoryEntry
@@ -590,31 +590,31 @@ struct directoryVFATEntry {
590 590
 typedef struct directoryEntry dir_t;
591 591
 /** Type name for directoryVFATEntry */
592 592
 typedef struct directoryVFATEntry vfat_t;
593
-/** escape for name[0] = 0XE5 */
594
-uint8_t const DIR_NAME_0XE5 = 0X05;
593
+/** escape for name[0] = 0xE5 */
594
+uint8_t const DIR_NAME_0xE5 = 0x05;
595 595
 /** name[0] value for entry that is free after being "deleted" */
596
-uint8_t const DIR_NAME_DELETED = 0XE5;
596
+uint8_t const DIR_NAME_DELETED = 0xE5;
597 597
 /** name[0] value for entry that is free and no allocated entries follow */
598
-uint8_t const DIR_NAME_FREE = 0X00;
598
+uint8_t const DIR_NAME_FREE = 0x00;
599 599
 /** file is read-only */
600
-uint8_t const DIR_ATT_READ_ONLY = 0X01;
600
+uint8_t const DIR_ATT_READ_ONLY = 0x01;
601 601
 /** File should hidden in directory listings */
602
-uint8_t const DIR_ATT_HIDDEN = 0X02;
602
+uint8_t const DIR_ATT_HIDDEN = 0x02;
603 603
 /** Entry is for a system file */
604
-uint8_t const DIR_ATT_SYSTEM = 0X04;
604
+uint8_t const DIR_ATT_SYSTEM = 0x04;
605 605
 /** Directory entry contains the volume label */
606
-uint8_t const DIR_ATT_VOLUME_ID = 0X08;
606
+uint8_t const DIR_ATT_VOLUME_ID = 0x08;
607 607
 /** Entry is for a directory */
608
-uint8_t const DIR_ATT_DIRECTORY = 0X10;
608
+uint8_t const DIR_ATT_DIRECTORY = 0x10;
609 609
 /** Old DOS archive bit for backup support */
610
-uint8_t const DIR_ATT_ARCHIVE = 0X20;
610
+uint8_t const DIR_ATT_ARCHIVE = 0x20;
611 611
 /** Test value for long name entry.  Test is
612 612
   (d->attributes & DIR_ATT_LONG_NAME_MASK) == DIR_ATT_LONG_NAME. */
613
-uint8_t const DIR_ATT_LONG_NAME = 0X0F;
613
+uint8_t const DIR_ATT_LONG_NAME = 0x0F;
614 614
 /** Test mask for long name entry */
615
-uint8_t const DIR_ATT_LONG_NAME_MASK = 0X3F;
615
+uint8_t const DIR_ATT_LONG_NAME_MASK = 0x3F;
616 616
 /** defined attribute bits */
617
-uint8_t const DIR_ATT_DEFINED_BITS = 0X3F;
617
+uint8_t const DIR_ATT_DEFINED_BITS = 0x3F;
618 618
 /** Directory entry is part of a long name
619 619
  * \param[in] dir Pointer to a directory entry.
620 620
  *

+ 26
- 26
Marlin/SdInfo.h ファイルの表示

@@ -45,59 +45,59 @@
45 45
 //------------------------------------------------------------------------------
46 46
 // SD card commands
47 47
 /** GO_IDLE_STATE - init card in spi mode if CS low */
48
-uint8_t const CMD0 = 0X00;
48
+uint8_t const CMD0 = 0x00;
49 49
 /** SEND_IF_COND - verify SD Memory Card interface operating condition.*/
50
-uint8_t const CMD8 = 0X08;
50
+uint8_t const CMD8 = 0x08;
51 51
 /** SEND_CSD - read the Card Specific Data (CSD register) */
52
-uint8_t const CMD9 = 0X09;
52
+uint8_t const CMD9 = 0x09;
53 53
 /** SEND_CID - read the card identification information (CID register) */
54
-uint8_t const CMD10 = 0X0A;
54
+uint8_t const CMD10 = 0x0A;
55 55
 /** STOP_TRANSMISSION - end multiple block read sequence */
56
-uint8_t const CMD12 = 0X0C;
56
+uint8_t const CMD12 = 0x0C;
57 57
 /** SEND_STATUS - read the card status register */
58
-uint8_t const CMD13 = 0X0D;
58
+uint8_t const CMD13 = 0x0D;
59 59
 /** READ_SINGLE_BLOCK - read a single data block from the card */
60
-uint8_t const CMD17 = 0X11;
60
+uint8_t const CMD17 = 0x11;
61 61
 /** READ_MULTIPLE_BLOCK - read a multiple data blocks from the card */
62
-uint8_t const CMD18 = 0X12;
62
+uint8_t const CMD18 = 0x12;
63 63
 /** WRITE_BLOCK - write a single data block to the card */
64
-uint8_t const CMD24 = 0X18;
64
+uint8_t const CMD24 = 0x18;
65 65
 /** WRITE_MULTIPLE_BLOCK - write blocks of data until a STOP_TRANSMISSION */
66
-uint8_t const CMD25 = 0X19;
66
+uint8_t const CMD25 = 0x19;
67 67
 /** ERASE_WR_BLK_START - sets the address of the first block to be erased */
68
-uint8_t const CMD32 = 0X20;
68
+uint8_t const CMD32 = 0x20;
69 69
 /** ERASE_WR_BLK_END - sets the address of the last block of the continuous
70 70
     range to be erased*/
71
-uint8_t const CMD33 = 0X21;
71
+uint8_t const CMD33 = 0x21;
72 72
 /** ERASE - erase all previously selected blocks */
73
-uint8_t const CMD38 = 0X26;
73
+uint8_t const CMD38 = 0x26;
74 74
 /** APP_CMD - escape for application specific command */
75
-uint8_t const CMD55 = 0X37;
75
+uint8_t const CMD55 = 0x37;
76 76
 /** READ_OCR - read the OCR register of a card */
77
-uint8_t const CMD58 = 0X3A;
77
+uint8_t const CMD58 = 0x3A;
78 78
 /** SET_WR_BLK_ERASE_COUNT - Set the number of write blocks to be
79 79
      pre-erased before writing */
80
-uint8_t const ACMD23 = 0X17;
80
+uint8_t const ACMD23 = 0x17;
81 81
 /** SD_SEND_OP_COMD - Sends host capacity support information and
82 82
     activates the card's initialization process */
83
-uint8_t const ACMD41 = 0X29;
83
+uint8_t const ACMD41 = 0x29;
84 84
 //------------------------------------------------------------------------------
85 85
 /** status for card in the ready state */
86
-uint8_t const R1_READY_STATE = 0X00;
86
+uint8_t const R1_READY_STATE = 0x00;
87 87
 /** status for card in the idle state */
88
-uint8_t const R1_IDLE_STATE = 0X01;
88
+uint8_t const R1_IDLE_STATE = 0x01;
89 89
 /** status bit for illegal command */
90
-uint8_t const R1_ILLEGAL_COMMAND = 0X04;
90
+uint8_t const R1_ILLEGAL_COMMAND = 0x04;
91 91
 /** start data token for read or write single block*/
92
-uint8_t const DATA_START_BLOCK = 0XFE;
92
+uint8_t const DATA_START_BLOCK = 0xFE;
93 93
 /** stop token for write multiple blocks*/
94
-uint8_t const STOP_TRAN_TOKEN = 0XFD;
94
+uint8_t const STOP_TRAN_TOKEN = 0xFD;
95 95
 /** start data token for write multiple blocks*/
96
-uint8_t const WRITE_MULTIPLE_TOKEN = 0XFC;
96
+uint8_t const WRITE_MULTIPLE_TOKEN = 0xFC;
97 97
 /** mask for data response tokens after a write block operation */
98
-uint8_t const DATA_RES_MASK = 0X1F;
98
+uint8_t const DATA_RES_MASK = 0x1F;
99 99
 /** write data accepted token */
100
-uint8_t const DATA_RES_ACCEPTED = 0X05;
100
+uint8_t const DATA_RES_ACCEPTED = 0x05;
101 101
 //------------------------------------------------------------------------------
102 102
 /** Card IDentification (CID) register */
103 103
 typedef struct CID {
@@ -203,7 +203,7 @@ typedef struct CSDV2 {
203 203
   unsigned char reserved1 : 6;
204 204
   unsigned char csd_ver : 2;
205 205
   // byte 1
206
-  /** fixed to 0X0E */
206
+  /** fixed to 0x0E */
207 207
   unsigned char taac;
208 208
   // byte 2
209 209
   /** fixed to 0 */

+ 48
- 48
Marlin/SdVolume.cpp ファイルの表示

@@ -73,14 +73,14 @@ bool SdVolume::allocContiguous(uint32_t count, uint32_t* curCluster) {
73 73
   // search the FAT for free clusters
74 74
   for (uint32_t n = 0;; n++, endCluster++) {
75 75
     // can't find space checked all clusters
76
-    if (n >= clusterCount_) goto fail;
76
+    if (n >= clusterCount_) goto FAIL;
77 77
 
78 78
     // past end - start from beginning of FAT
79 79
     if (endCluster > fatEnd) {
80 80
       bgnCluster = endCluster = 2;
81 81
     }
82 82
     uint32_t f;
83
-    if (!fatGet(endCluster, &f)) goto fail;
83
+    if (!fatGet(endCluster, &f)) goto FAIL;
84 84
 
85 85
     if (f != 0) {
86 86
       // cluster in use try next cluster as bgnCluster
@@ -92,16 +92,16 @@ bool SdVolume::allocContiguous(uint32_t count, uint32_t* curCluster) {
92 92
     }
93 93
   }
94 94
   // mark end of chain
95
-  if (!fatPutEOC(endCluster)) goto fail;
95
+  if (!fatPutEOC(endCluster)) goto FAIL;
96 96
 
97 97
   // link clusters
98 98
   while (endCluster > bgnCluster) {
99
-    if (!fatPut(endCluster - 1, endCluster)) goto fail;
99
+    if (!fatPut(endCluster - 1, endCluster)) goto FAIL;
100 100
     endCluster--;
101 101
   }
102 102
   if (*curCluster != 0) {
103 103
     // connect chains
104
-    if (!fatPut(*curCluster, bgnCluster)) goto fail;
104
+    if (!fatPut(*curCluster, bgnCluster)) goto FAIL;
105 105
   }
106 106
   // return first cluster number to caller
107 107
   *curCluster = bgnCluster;
@@ -110,38 +110,38 @@ bool SdVolume::allocContiguous(uint32_t count, uint32_t* curCluster) {
110 110
   if (setStart) allocSearchStart_ = bgnCluster + 1;
111 111
 
112 112
   return true;
113
-fail:
113
+  FAIL:
114 114
   return false;
115 115
 }
116 116
 //------------------------------------------------------------------------------
117 117
 bool SdVolume::cacheFlush() {
118 118
   if (cacheDirty_) {
119 119
     if (!sdCard_->writeBlock(cacheBlockNumber_, cacheBuffer_.data)) {
120
-      goto fail;
120
+      goto FAIL;
121 121
     }
122 122
     // mirror FAT tables
123 123
     if (cacheMirrorBlock_) {
124 124
       if (!sdCard_->writeBlock(cacheMirrorBlock_, cacheBuffer_.data)) {
125
-        goto fail;
125
+        goto FAIL;
126 126
       }
127 127
       cacheMirrorBlock_ = 0;
128 128
     }
129 129
     cacheDirty_ = 0;
130 130
   }
131 131
   return true;
132
-fail:
132
+  FAIL:
133 133
   return false;
134 134
 }
135 135
 //------------------------------------------------------------------------------
136 136
 bool SdVolume::cacheRawBlock(uint32_t blockNumber, bool dirty) {
137 137
   if (cacheBlockNumber_ != blockNumber) {
138
-    if (!cacheFlush()) goto fail;
139
-    if (!sdCard_->readBlock(blockNumber, cacheBuffer_.data)) goto fail;
138
+    if (!cacheFlush()) goto FAIL;
139
+    if (!sdCard_->readBlock(blockNumber, cacheBuffer_.data)) goto FAIL;
140 140
     cacheBlockNumber_ = blockNumber;
141 141
   }
142 142
   if (dirty) cacheDirty_ = true;
143 143
   return true;
144
-fail:
144
+  FAIL:
145 145
   return false;
146 146
 }
147 147
 //------------------------------------------------------------------------------
@@ -149,33 +149,33 @@ fail:
149 149
 bool SdVolume::chainSize(uint32_t cluster, uint32_t* size) {
150 150
   uint32_t s = 0;
151 151
   do {
152
-    if (!fatGet(cluster, &cluster)) goto fail;
152
+    if (!fatGet(cluster, &cluster)) goto FAIL;
153 153
     s += 512UL << clusterSizeShift_;
154 154
   } while (!isEOC(cluster));
155 155
   *size = s;
156 156
   return true;
157
-fail:
157
+  FAIL:
158 158
   return false;
159 159
 }
160 160
 //------------------------------------------------------------------------------
161 161
 // Fetch a FAT entry
162 162
 bool SdVolume::fatGet(uint32_t cluster, uint32_t* value) {
163 163
   uint32_t lba;
164
-  if (cluster > (clusterCount_ + 1)) goto fail;
164
+  if (cluster > (clusterCount_ + 1)) goto FAIL;
165 165
   if (FAT12_SUPPORT && fatType_ == 12) {
166 166
     uint16_t index = cluster;
167 167
     index += index >> 1;
168 168
     lba = fatStartBlock_ + (index >> 9);
169
-    if (!cacheRawBlock(lba, CACHE_FOR_READ)) goto fail;
170
-    index &= 0X1FF;
169
+    if (!cacheRawBlock(lba, CACHE_FOR_READ)) goto FAIL;
170
+    index &= 0x1FF;
171 171
     uint16_t tmp = cacheBuffer_.data[index];
172 172
     index++;
173 173
     if (index == 512) {
174
-      if (!cacheRawBlock(lba + 1, CACHE_FOR_READ)) goto fail;
174
+      if (!cacheRawBlock(lba + 1, CACHE_FOR_READ)) goto FAIL;
175 175
       index = 0;
176 176
     }
177 177
     tmp |= cacheBuffer_.data[index] << 8;
178
-    *value = cluster & 1 ? tmp >> 4 : tmp & 0XFFF;
178
+    *value = cluster & 1 ? tmp >> 4 : tmp & 0xFFF;
179 179
     return true;
180 180
   }
181 181
   if (fatType_ == 16) {
@@ -185,19 +185,19 @@ bool SdVolume::fatGet(uint32_t cluster, uint32_t* value) {
185 185
     lba = fatStartBlock_ + (cluster >> 7);
186 186
   }
187 187
   else {
188
-    goto fail;
188
+    goto FAIL;
189 189
   }
190 190
   if (lba != cacheBlockNumber_) {
191
-    if (!cacheRawBlock(lba, CACHE_FOR_READ)) goto fail;
191
+    if (!cacheRawBlock(lba, CACHE_FOR_READ)) goto FAIL;
192 192
   }
193 193
   if (fatType_ == 16) {
194
-    *value = cacheBuffer_.fat16[cluster & 0XFF];
194
+    *value = cacheBuffer_.fat16[cluster & 0xFF];
195 195
   }
196 196
   else {
197
-    *value = cacheBuffer_.fat32[cluster & 0X7F] & FAT32MASK;
197
+    *value = cacheBuffer_.fat32[cluster & 0x7F] & FAT32MASK;
198 198
   }
199 199
   return true;
200
-fail:
200
+  FAIL:
201 201
   return false;
202 202
 }
203 203
 //------------------------------------------------------------------------------
@@ -205,19 +205,19 @@ fail:
205 205
 bool SdVolume::fatPut(uint32_t cluster, uint32_t value) {
206 206
   uint32_t lba;
207 207
   // error if reserved cluster
208
-  if (cluster < 2) goto fail;
208
+  if (cluster < 2) goto FAIL;
209 209
 
210 210
   // error if not in FAT
211
-  if (cluster > (clusterCount_ + 1)) goto fail;
211
+  if (cluster > (clusterCount_ + 1)) goto FAIL;
212 212
 
213 213
   if (FAT12_SUPPORT && fatType_ == 12) {
214 214
     uint16_t index = cluster;
215 215
     index += index >> 1;
216 216
     lba = fatStartBlock_ + (index >> 9);
217
-    if (!cacheRawBlock(lba, CACHE_FOR_WRITE)) goto fail;
217
+    if (!cacheRawBlock(lba, CACHE_FOR_WRITE)) goto FAIL;
218 218
     // mirror second FAT
219 219
     if (fatCount_ > 1) cacheMirrorBlock_ = lba + blocksPerFat_;
220
-    index &= 0X1FF;
220
+    index &= 0x1FF;
221 221
     uint8_t tmp = value;
222 222
     if (cluster & 1) {
223 223
       tmp = (cacheBuffer_.data[index] & 0XF) | tmp << 4;
@@ -227,13 +227,13 @@ bool SdVolume::fatPut(uint32_t cluster, uint32_t value) {
227 227
     if (index == 512) {
228 228
       lba++;
229 229
       index = 0;
230
-      if (!cacheRawBlock(lba, CACHE_FOR_WRITE)) goto fail;
230
+      if (!cacheRawBlock(lba, CACHE_FOR_WRITE)) goto FAIL;
231 231
       // mirror second FAT
232 232
       if (fatCount_ > 1) cacheMirrorBlock_ = lba + blocksPerFat_;
233 233
     }
234 234
     tmp = value >> 4;
235 235
     if (!(cluster & 1)) {
236
-      tmp = ((cacheBuffer_.data[index] & 0XF0)) | tmp >> 4;
236
+      tmp = ((cacheBuffer_.data[index] & 0xF0)) | tmp >> 4;
237 237
     }
238 238
     cacheBuffer_.data[index] = tmp;
239 239
     return true;
@@ -245,20 +245,20 @@ bool SdVolume::fatPut(uint32_t cluster, uint32_t value) {
245 245
     lba = fatStartBlock_ + (cluster >> 7);
246 246
   }
247 247
   else {
248
-    goto fail;
248
+    goto FAIL;
249 249
   }
250
-  if (!cacheRawBlock(lba, CACHE_FOR_WRITE)) goto fail;
250
+  if (!cacheRawBlock(lba, CACHE_FOR_WRITE)) goto FAIL;
251 251
   // store entry
252 252
   if (fatType_ == 16) {
253
-    cacheBuffer_.fat16[cluster & 0XFF] = value;
253
+    cacheBuffer_.fat16[cluster & 0xFF] = value;
254 254
   }
255 255
   else {
256
-    cacheBuffer_.fat32[cluster & 0X7F] = value;
256
+    cacheBuffer_.fat32[cluster & 0x7F] = value;
257 257
   }
258 258
   // mirror second FAT
259 259
   if (fatCount_ > 1) cacheMirrorBlock_ = lba + blocksPerFat_;
260 260
   return true;
261
-fail:
261
+  FAIL:
262 262
   return false;
263 263
 }
264 264
 //------------------------------------------------------------------------------
@@ -270,16 +270,16 @@ bool SdVolume::freeChain(uint32_t cluster) {
270 270
   allocSearchStart_ = 2;
271 271
 
272 272
   do {
273
-    if (!fatGet(cluster, &next)) goto fail;
273
+    if (!fatGet(cluster, &next)) goto FAIL;
274 274
 
275 275
     // free cluster
276
-    if (!fatPut(cluster, 0)) goto fail;
276
+    if (!fatPut(cluster, 0)) goto FAIL;
277 277
 
278 278
     cluster = next;
279 279
   } while (!isEOC(cluster));
280 280
 
281 281
   return true;
282
-fail:
282
+  FAIL:
283 283
   return false;
284 284
 }
285 285
 //------------------------------------------------------------------------------
@@ -344,30 +344,30 @@ bool SdVolume::init(Sd2Card* dev, uint8_t part) {
344 344
   allocSearchStart_ = 2;
345 345
   cacheDirty_ = 0;  // cacheFlush() will write block if true
346 346
   cacheMirrorBlock_ = 0;
347
-  cacheBlockNumber_ = 0XFFFFFFFF;
347
+  cacheBlockNumber_ = 0xFFFFFFFF;
348 348
 
349 349
   // if part == 0 assume super floppy with FAT boot sector in block zero
350 350
   // if part > 0 assume mbr volume with partition table
351 351
   if (part) {
352
-    if (part > 4)goto fail;
353
-    if (!cacheRawBlock(volumeStartBlock, CACHE_FOR_READ)) goto fail;
352
+    if (part > 4)goto FAIL;
353
+    if (!cacheRawBlock(volumeStartBlock, CACHE_FOR_READ)) goto FAIL;
354 354
     part_t* p = &cacheBuffer_.mbr.part[part - 1];
355
-    if ((p->boot & 0X7F) != 0  ||
355
+    if ((p->boot & 0x7F) != 0  ||
356 356
         p->totalSectors < 100 ||
357 357
         p->firstSector == 0) {
358 358
       // not a valid partition
359
-      goto fail;
359
+      goto FAIL;
360 360
     }
361 361
     volumeStartBlock = p->firstSector;
362 362
   }
363
-  if (!cacheRawBlock(volumeStartBlock, CACHE_FOR_READ)) goto fail;
363
+  if (!cacheRawBlock(volumeStartBlock, CACHE_FOR_READ)) goto FAIL;
364 364
   fbs = &cacheBuffer_.fbs32;
365 365
   if (fbs->bytesPerSector != 512 ||
366 366
       fbs->fatCount == 0 ||
367 367
       fbs->reservedSectorCount == 0 ||
368 368
       fbs->sectorsPerCluster == 0) {
369 369
     // not valid FAT volume
370
-    goto fail;
370
+    goto FAIL;
371 371
   }
372 372
   fatCount_ = fbs->fatCount;
373 373
   blocksPerCluster_ = fbs->sectorsPerCluster;
@@ -375,7 +375,7 @@ bool SdVolume::init(Sd2Card* dev, uint8_t part) {
375 375
   clusterSizeShift_ = 0;
376 376
   while (blocksPerCluster_ != _BV(clusterSizeShift_)) {
377 377
     // error if not power of 2
378
-    if (clusterSizeShift_++ > 7) goto fail;
378
+    if (clusterSizeShift_++ > 7) goto FAIL;
379 379
   }
380 380
   blocksPerFat_ = fbs->sectorsPerFat16 ?
381 381
                   fbs->sectorsPerFat16 : fbs->sectorsPerFat32;
@@ -404,7 +404,7 @@ bool SdVolume::init(Sd2Card* dev, uint8_t part) {
404 404
   // FAT type is determined by cluster count
405 405
   if (clusterCount_ < 4085) {
406 406
     fatType_ = 12;
407
-    if (!FAT12_SUPPORT) goto fail;
407
+    if (!FAT12_SUPPORT) goto FAIL;
408 408
   }
409 409
   else if (clusterCount_ < 65525) {
410 410
     fatType_ = 16;
@@ -414,7 +414,7 @@ bool SdVolume::init(Sd2Card* dev, uint8_t part) {
414 414
     fatType_ = 32;
415 415
   }
416 416
   return true;
417
-fail:
417
+  FAIL:
418 418
   return false;
419 419
 }
420 420
 #endif

+ 1
- 1
Marlin/SdVolume.h ファイルの表示

@@ -76,7 +76,7 @@ class SdVolume {
76 76
    */
77 77
   cache_t* cacheClear() {
78 78
     if (!cacheFlush()) return 0;
79
-    cacheBlockNumber_ = 0XFFFFFFFF;
79
+    cacheBlockNumber_ = 0xFFFFFFFF;
80 80
     return &cacheBuffer_;
81 81
   }
82 82
   /** Initialize a FAT volume.  Try partition one first then try super

+ 1
- 1
Marlin/example_configurations/Creality/CR-10/Configuration.h ファイルの表示

@@ -74,7 +74,7 @@
74 74
 // User-specified version info of this build to display in [Pronterface, etc] terminal window during
75 75
 // startup. Implementation of an idea by Prof Braino to inform user that any changes made to this
76 76
 // build by the user have been successfully uploaded into firmware.
77
-#define STRING_CONFIG_H_AUTHOR "(none, default config)" // Who made the changes.
77
+#define STRING_CONFIG_H_AUTHOR "(Creality CR-10)" // Who made the changes.
78 78
 #define SHOW_BOOTSCREEN
79 79
 #define STRING_SPLASH_LINE1 SHORT_BUILD_VERSION // will be shown during bootup in line 1
80 80
 //#define STRING_SPLASH_LINE2 WEBSITE_URL         // will be shown during bootup in line 2

+ 1
- 1
Marlin/pca9632.cpp ファイルの表示

@@ -45,7 +45,7 @@
45 45
 #define PCA9632_PWM3        0x05
46 46
 #define PCA9632_GRPPWM      0x06
47 47
 #define PCA9632_GRPFREQ     0x07
48
-#define PCA9632_LEDOUT      0X08
48
+#define PCA9632_LEDOUT      0x08
49 49
 #define PCA9632_SUBADR1     0x09
50 50
 #define PCA9632_SUBADR2     0x0A
51 51
 #define PCA9632_SUBADR3     0x0B

+ 1
- 1
Marlin/pins_MELZI_CREALITY.h ファイルの表示

@@ -24,7 +24,7 @@
24 24
  * Melzi (Creality) pin assignments
25 25
  */
26 26
 
27
-#define BOARD_NAME "Melzi Creality"
27
+#define BOARD_NAME "Melzi (Creality)"
28 28
 
29 29
 #ifdef __AVR_ATmega1284P__
30 30
   #define LARGE_FLASH true

+ 1
- 1
Marlin/pins_MELZI_MAKR3D.h ファイルの表示

@@ -24,7 +24,7 @@
24 24
  * Melzi with ATmega1284 (MaKr3d version) pin assignments
25 25
  */
26 26
 
27
-#define BOARD_NAME "Melzi ATmega1284"
27
+#define BOARD_NAME "Melzi (ATmega1284)"
28 28
 
29 29
 #ifdef __AVR_ATmega1284P__
30 30
   #define LARGE_FLASH true

+ 3
- 3
Marlin/softspi.h ファイルの表示

@@ -455,7 +455,7 @@ void badPinCheck(uint8_t pin) {
455 455
 static inline __attribute__((always_inline))
456 456
 void fastBitWriteSafe(volatile uint8_t* address, uint8_t bit, bool level) {
457 457
   uint8_t oldSREG;
458
-  if (address > (uint8_t*)0X5F) {
458
+  if (address > (uint8_t*)0x5F) {
459 459
     oldSREG = SREG;
460 460
     cli();
461 461
   }
@@ -464,7 +464,7 @@ void fastBitWriteSafe(volatile uint8_t* address, uint8_t bit, bool level) {
464 464
   } else {
465 465
     *address &= ~(1 << bit);
466 466
   }
467
-  if (address > (uint8_t*)0X5F) {
467
+  if (address > (uint8_t*)0x5F) {
468 468
     SREG = oldSREG;
469 469
   }
470 470
 }
@@ -488,7 +488,7 @@ bool fastDigitalRead(uint8_t pin) {
488 488
 static inline __attribute__((always_inline))
489 489
 void fastDigitalToggle(uint8_t pin) {
490 490
   badPinCheck(pin);
491
-    if (pinMap[pin].pin > (uint8_t*)0X5F) {
491
+    if (pinMap[pin].pin > (uint8_t*)0x5F) {
492 492
       // must write bit to high address port
493 493
       *pinMap[pin].pin = 1 << pinMap[pin].bit;
494 494
     } else {

+ 9
- 4
Marlin/ultralcd.cpp ファイルの表示

@@ -2720,11 +2720,16 @@ void kill_screen(const char* lcd_msg) {
2720 2720
 
2721 2721
   screenFunc_t _manual_move_func_ptr;
2722 2722
 
2723
-  void lcd_move_menu_10mm() { move_menu_scale = 10.0; lcd_goto_screen(_manual_move_func_ptr); }
2724
-  void lcd_move_menu_1mm()  { move_menu_scale =  1.0; lcd_goto_screen(_manual_move_func_ptr); }
2725
-  void lcd_move_menu_01mm() { move_menu_scale =  0.1; lcd_goto_screen(_manual_move_func_ptr); }
2723
+  void _goto_manual_move(const float scale) {
2724
+    defer_return_to_status = true;
2725
+    move_menu_scale = scale;
2726
+    lcd_goto_screen(_manual_move_func_ptr);
2727
+  }
2728
+  void lcd_move_menu_10mm() { _goto_manual_move(10.0); }
2729
+  void lcd_move_menu_1mm()  { _goto_manual_move( 1.0); }
2730
+  void lcd_move_menu_01mm() { _goto_manual_move( 0.1); }
2726 2731
 
2727
-  void _lcd_move_distance_menu(AxisEnum axis, screenFunc_t func) {
2732
+  void _lcd_move_distance_menu(const AxisEnum axis, const screenFunc_t func) {
2728 2733
     _manual_move_func_ptr = func;
2729 2734
     START_MENU();
2730 2735
     if (LCD_HEIGHT >= 4) {

読み込み中…
キャンセル
保存