Bläddra i källkod

Merge remote-tracking branch 'MarlinFirmware/Development' into Development

Conflicts:
	Marlin/Configuration.h
Chris Roadfeldt 10 år sedan
förälder
incheckning
3be00cce6f
4 ändrade filer med 155 tillägg och 164 borttagningar
  1. 3
    5
      Marlin/Conditionals.h
  2. 13
    8
      Marlin/Configuration.h
  3. 33
    30
      Marlin/Marlin_main.cpp
  4. 106
    121
      Marlin/ultralcd.cpp

+ 3
- 5
Marlin/Conditionals.h Visa fil

@@ -265,16 +265,14 @@
265 265
   #ifndef POWER_SUPPLY
266 266
     #define POWER_SUPPLY 1
267 267
   #endif
268
-  // 1 = ATX
269
-  #if (POWER_SUPPLY == 1)
268
+  #if (POWER_SUPPLY == 1)     // 1 = ATX
270 269
     #define PS_ON_AWAKE  LOW
271 270
     #define PS_ON_ASLEEP HIGH
272
-  #endif
273
-  // 2 = X-Box 360 203W
274
-  #if (POWER_SUPPLY == 2)
271
+  #elif (POWER_SUPPLY == 2)   // 2 = X-Box 360 203W
275 272
     #define PS_ON_AWAKE  HIGH
276 273
     #define PS_ON_ASLEEP LOW
277 274
   #endif
275
+  #define HAS_POWER_SWITCH (POWER_SUPPLY > 0 && defined(PS_ON_PIN) && PS_ON_PIN >= 0)
278 276
 
279 277
   /**
280 278
    * Temp Sensor defines

+ 13
- 8
Marlin/Configuration.h Visa fil

@@ -302,14 +302,19 @@ your extruder heater takes 2 minutes to hit the target on heating.
302 302
 // Enable this option for Toshiba steppers
303 303
 // #define CONFIG_STEPPERS_TOSHIBA
304 304
 
305
-// The pullups are needed if you directly connect a mechanical endstop between the signal and ground pins.
306
-#define ENDSTOPPULLUP_XMAX
307
-#define ENDSTOPPULLUP_YMAX
308
-#define ENDSTOPPULLUP_ZMAX
309
-#define ENDSTOPPULLUP_XMIN
310
-#define ENDSTOPPULLUP_YMIN
311
-#define ENDSTOPPULLUP_ZMIN
312
-#define ENDSTOPPULLUP_ZPROBE
305
+// coarse Endstop Settings
306
+#define ENDSTOPPULLUPS // Comment this out (using // at the start of the line) to disable the endstop pullup resistors
307
+
308
+#ifndef ENDSTOPPULLUPS
309
+  // fine endstop settings: Individual pullups. will be ignored if ENDSTOPPULLUPS is defined
310
+  // #define ENDSTOPPULLUP_XMAX
311
+  // #define ENDSTOPPULLUP_YMAX
312
+  // #define ENDSTOPPULLUP_ZMAX
313
+  // #define ENDSTOPPULLUP_XMIN
314
+  // #define ENDSTOPPULLUP_YMIN
315
+  // #define ENDSTOPPULLUP_ZMIN
316
+#endif
317
+>>>>>>> MarlinFirmware/Development
313 318
 
314 319
 // Mechanical endstop with COM to ground and NC to Signal uses "false" here (most common setup).
315 320
 const bool X_MIN_ENDSTOP_INVERTING = false; // set to true to invert the logic of the endstop.

+ 33
- 30
Marlin/Marlin_main.cpp Visa fil

@@ -168,12 +168,12 @@
168 168
 // M401 - Lower z-probe if present
169 169
 // M402 - Raise z-probe if present
170 170
 // M404 - N<dia in mm> Enter the nominal filament width (3mm, 1.75mm ) or will display nominal filament width without parameters
171
-// M405 - Turn on Filament Sensor extrusion control.  Optional D<delay in cm> to set delay in centimeters between sensor and extruder 
172
-// M406 - Turn off Filament Sensor extrusion control 
173
-// M407 - Displays measured filament diameter 
171
+// M405 - Turn on Filament Sensor extrusion control.  Optional D<delay in cm> to set delay in centimeters between sensor and extruder
172
+// M406 - Turn off Filament Sensor extrusion control
173
+// M407 - Display measured filament diameter
174 174
 // M500 - Store parameters in EEPROM
175 175
 // M501 - Read parameters from EEPROM (if you need reset them after you changed them temporarily).
176
-// M502 - Revert to the default "factory settings".  You still need to store them in EEPROM afterwards if you want to.
176
+// M502 - Revert to the default "factory settings". You still need to store them in EEPROM afterwards if you want to.
177 177
 // M503 - Print the current settings (from memory not from EEPROM). Use S0 to leave off headings.
178 178
 // M540 - Use S[0|1] to enable or disable the stop SD card print on endstop hit (requires ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED)
179 179
 // M600 - Pause for filament change X[pos] Y[pos] Z[relative lift] E[initial retract] L[later retract distance for removal]
@@ -273,7 +273,7 @@ int fanSpeed = 0;
273 273
 
274 274
 #endif // FWRETRACT
275 275
 
276
-#ifdef ULTIPANEL
276
+#if defined(ULTIPANEL) && HAS_POWER_SWITCH
277 277
   bool powersupply = 
278 278
     #ifdef PS_DEFAULT_OFF
279 279
       false
@@ -311,14 +311,14 @@ int fanSpeed = 0;
311 311
 bool cancel_heatup = false;
312 312
 
313 313
 #ifdef FILAMENT_SENSOR
314
-  //Variables for Filament Sensor input 
315
-  float filament_width_nominal=DEFAULT_NOMINAL_FILAMENT_DIA;  //Set nominal filament width, can be changed with M404 
316
-  bool filament_sensor=false;  //M405 turns on filament_sensor control, M406 turns it off 
317
-  float filament_width_meas=DEFAULT_MEASURED_FILAMENT_DIA; //Stores the measured filament diameter 
318
-  signed char measurement_delay[MAX_MEASUREMENT_DELAY+1];  //ring buffer to delay measurement  store extruder factor after subtracting 100 
319
-  int delay_index1=0;  //index into ring buffer
320
-  int delay_index2=-1;  //index into ring buffer - set to -1 on startup to indicate ring buffer needs to be initialized
321
-  float delay_dist=0; //delay distance counter  
314
+  //Variables for Filament Sensor input
315
+  float filament_width_nominal = DEFAULT_NOMINAL_FILAMENT_DIA;  //Set nominal filament width, can be changed with M404
316
+  bool filament_sensor = false;  //M405 turns on filament_sensor control, M406 turns it off
317
+  float filament_width_meas = DEFAULT_MEASURED_FILAMENT_DIA; //Stores the measured filament diameter
318
+  signed char measurement_delay[MAX_MEASUREMENT_DELAY+1];  //ring buffer to delay measurement  store extruder factor after subtracting 100
319
+  int delay_index1 = 0;  //index into ring buffer
320
+  int delay_index2 = -1;  //index into ring buffer - set to -1 on startup to indicate ring buffer needs to be initialized
321
+  float delay_dist = 0; //delay distance counter
322 322
   int meas_delay_cm = MEASUREMENT_DELAY_CM;  //distance delay setting
323 323
 #endif
324 324
 
@@ -519,8 +519,8 @@ void setup_powerhold()
519 519
   #if defined(SUICIDE_PIN) && SUICIDE_PIN > -1
520 520
     OUT_WRITE(SUICIDE_PIN, HIGH);
521 521
   #endif
522
-  #if defined(PS_ON_PIN) && PS_ON_PIN > -1
523
-    #if defined(PS_DEFAULT_OFF)
522
+  #if HAS_POWER_SWITCH
523
+    #ifdef PS_DEFAULT_OFF
524 524
       OUT_WRITE(PS_ON_PIN, PS_ON_ASLEEP);
525 525
     #else
526 526
       OUT_WRITE(PS_ON_PIN, PS_ON_AWAKE);
@@ -3269,7 +3269,7 @@ inline void gcode_M140() {
3269 3269
   if (code_seen('S')) setTargetBed(code_value());
3270 3270
 }
3271 3271
 
3272
-#if defined(PS_ON_PIN) && PS_ON_PIN > -1
3272
+#if HAS_POWER_SWITCH
3273 3273
 
3274 3274
   /**
3275 3275
    * M80: Turn on Power Supply
@@ -3291,10 +3291,12 @@ inline void gcode_M140() {
3291 3291
     #endif
3292 3292
   }
3293 3293
 
3294
-#endif // PS_ON_PIN
3294
+#endif // HAS_POWER_SWITCH
3295 3295
 
3296 3296
 /**
3297
- * M81: Turn off Power Supply
3297
+ * M81: Turn off Power, including Power Supply, if there is one.
3298
+ *
3299
+ *      This code should ALWAYS be available for EMERGENCY SHUTDOWN!
3298 3300
  */
3299 3301
 inline void gcode_M81() {
3300 3302
   disable_heater();
@@ -3309,16 +3311,19 @@ inline void gcode_M81() {
3309 3311
   #if defined(SUICIDE_PIN) && SUICIDE_PIN > -1
3310 3312
     st_synchronize();
3311 3313
     suicide();
3312
-  #elif defined(PS_ON_PIN) && PS_ON_PIN > -1
3314
+  #elif HAS_POWER_SWITCH
3313 3315
     OUT_WRITE(PS_ON_PIN, PS_ON_ASLEEP);
3314 3316
   #endif
3315 3317
   #ifdef ULTIPANEL
3316
-    powersupply = false;
3318
+    #if HAS_POWER_SWITCH
3319
+      powersupply = false;
3320
+    #endif
3317 3321
     LCD_MESSAGEPGM(MACHINE_NAME " " MSG_OFF ".");
3318 3322
     lcd_update();
3319 3323
   #endif
3320 3324
 }
3321 3325
 
3326
+
3322 3327
 /**
3323 3328
  * M82: Set E codes absolute (default)
3324 3329
  */
@@ -4859,15 +4864,15 @@ void process_commands() {
4859 4864
         #endif //HEATER_2_PIN
4860 4865
       #endif //BARICUDA
4861 4866
 
4862
-      #if defined(PS_ON_PIN) && PS_ON_PIN > -1
4867
+      #if HAS_POWER_SWITCH
4863 4868
 
4864 4869
         case 80: // M80 - Turn on Power Supply
4865 4870
           gcode_M80();
4866 4871
           break;
4867 4872
 
4868
-      #endif // PS_ON_PIN
4873
+      #endif // HAS_POWER_SWITCH
4869 4874
 
4870
-      case 81: // M81 - Turn off Power Supply
4875
+      case 81: // M81 - Turn off Power, including Power Supply, if possible
4871 4876
         gcode_M81();
4872 4877
         break;
4873 4878
 
@@ -5841,19 +5846,17 @@ void kill()
5841 5846
   disable_e2();
5842 5847
   disable_e3();
5843 5848
 
5844
-#if defined(PS_ON_PIN) && PS_ON_PIN > -1
5845
-  pinMode(PS_ON_PIN,INPUT);
5846
-#endif
5849
+  #if HAS_POWER_SWITCH
5850
+    pinMode(PS_ON_PIN, INPUT);
5851
+  #endif
5852
+
5847 5853
   SERIAL_ERROR_START;
5848 5854
   SERIAL_ERRORLNPGM(MSG_ERR_KILLED);
5849 5855
   LCD_ALERTMESSAGEPGM(MSG_KILLED);
5850 5856
   
5851 5857
   // FMC small patch to update the LCD before ending
5852 5858
   sei();   // enable interrupts
5853
-  for ( int i=5; i--; lcd_update())
5854
-  {
5855
-     delay(200);  
5856
-  }
5859
+  for (int i = 5; i--; lcd_update()) delay(200); // Wait a short time
5857 5860
   cli();   // disable interrupts
5858 5861
   suicide();
5859 5862
   while(1) { /* Intentionally left empty */ } // Wait for reset

+ 106
- 121
Marlin/ultralcd.cpp Visa fil

@@ -44,7 +44,9 @@ static void lcd_status_screen();
44 44
 
45 45
 #ifdef ULTIPANEL
46 46
 
47
-  extern bool powersupply;
47
+  #if HAS_POWER_SWITCH
48
+    extern bool powersupply;
49
+  #endif
48 50
   static float manual_feedrate[] = MANUAL_FEEDRATE;
49 51
   static void lcd_main_menu();
50 52
   static void lcd_tune_menu();
@@ -616,6 +618,7 @@ static void lcd_prepare_menu() {
616 618
   MENU_ITEM(gcode, MSG_AUTO_HOME, PSTR("G28"));
617 619
   MENU_ITEM(function, MSG_SET_HOME_OFFSETS, lcd_set_home_offsets);
618 620
   //MENU_ITEM(gcode, MSG_SET_ORIGIN, PSTR("G92 X0 Y0 Z0"));
621
+
619 622
   #if TEMP_SENSOR_0 != 0
620 623
     #if TEMP_SENSOR_1 != 0 || TEMP_SENSOR_2 != 0 || TEMP_SENSOR_3 != 0 || TEMP_SENSOR_BED != 0
621 624
       MENU_ITEM(submenu, MSG_PREHEAT_PLA, lcd_preheat_pla_menu);
@@ -625,15 +628,16 @@ static void lcd_prepare_menu() {
625 628
       MENU_ITEM(function, MSG_PREHEAT_ABS, lcd_preheat_abs0);
626 629
     #endif
627 630
   #endif
631
+
628 632
   MENU_ITEM(function, MSG_COOLDOWN, lcd_cooldown);
629
-  #if defined(POWER_SUPPLY) && POWER_SUPPLY > 0 && defined(PS_ON_PIN) && PS_ON_PIN > -1
630
-    if (powersupply) {
633
+
634
+  #if HAS_POWER_SWITCH
635
+    if (powersupply)
631 636
       MENU_ITEM(gcode, MSG_SWITCH_PS_OFF, PSTR("M81"));
632
-    }
633
-    else {
637
+    else
634 638
       MENU_ITEM(gcode, MSG_SWITCH_PS_ON, PSTR("M80"));
635
-    }
636 639
   #endif
640
+
637 641
   MENU_ITEM(submenu, MSG_MOVE_AXIS, lcd_move_menu);
638 642
 
639 643
   #if defined(MANUAL_BED_LEVELING)
@@ -1338,7 +1342,7 @@ void lcd_update() {
1338 1342
               }
1339 1343
 
1340 1344
               lastEncoderMovementMillis = ms;
1341
-            }
1345
+            } // encoderRateMultiplierEnabled
1342 1346
           #endif //ENCODER_RATE_MULTIPLIER
1343 1347
 
1344 1348
           lcdDrawUpdate = 1;
@@ -1541,70 +1545,62 @@ bool lcd_clicked() { return LCD_CLICKED; }
1541 1545
 
1542 1546
 #endif //ULTIPANEL
1543 1547
 
1544
-/********************************/
1545
-/** Float conversion utilities **/
1546
-/********************************/
1547
-//  convert float to string with +123.4 format
1548
+/*********************************/
1549
+/** Number to string conversion **/
1550
+/*********************************/
1551
+
1548 1552
 char conv[8];
1549
-char *ftostr3(const float &x)
1550
-{
1553
+
1554
+// Convert float to string with +123.4 format
1555
+char *ftostr3(const float &x) {
1551 1556
   return itostr3((int)x);
1552 1557
 }
1553 1558
 
1554
-char *itostr2(const uint8_t &x)
1555
-{
1559
+// Convert int to string with 12 format
1560
+char *itostr2(const uint8_t &x) {
1556 1561
   //sprintf(conv,"%5.1f",x);
1557
-  int xx=x;
1558
-  conv[0]=(xx/10)%10+'0';
1559
-  conv[1]=(xx)%10+'0';
1560
-  conv[2]=0;
1562
+  int xx = x;
1563
+  conv[0] = (xx / 10) % 10 + '0';
1564
+  conv[1] = xx % 10 + '0';
1565
+  conv[2] = 0;
1561 1566
   return conv;
1562 1567
 }
1563 1568
 
1564
-// Convert float to string with 123.4 format, dropping sign
1565
-char *ftostr31(const float &x)
1566
-{
1567
-  int xx=x*10;
1568
-  conv[0]=(xx>=0)?'+':'-';
1569
-  xx=abs(xx);
1570
-  conv[1]=(xx/1000)%10+'0';
1571
-  conv[2]=(xx/100)%10+'0';
1572
-  conv[3]=(xx/10)%10+'0';
1573
-  conv[4]='.';
1574
-  conv[5]=(xx)%10+'0';
1575
-  conv[6]=0;
1569
+// Convert float to string with +123.4 format
1570
+char *ftostr31(const float &x) {
1571
+  int xx = abs(x * 10);
1572
+  conv[0] = (x >= 0) ? '+' : '-';
1573
+  conv[1] = (xx / 1000) % 10 + '0';
1574
+  conv[2] = (xx / 100) % 10 + '0';
1575
+  conv[3] = (xx / 10) % 10 + '0';
1576
+  conv[4] = '.';
1577
+  conv[5] = xx % 10 + '0';
1578
+  conv[6] = 0;
1576 1579
   return conv;
1577 1580
 }
1578 1581
 
1579
-// Convert float to string with 123.4 format
1580
-char *ftostr31ns(const float &x)
1581
-{
1582
-  int xx=x*10;
1583
-  //conv[0]=(xx>=0)?'+':'-';
1584
-  xx=abs(xx);
1585
-  conv[0]=(xx/1000)%10+'0';
1586
-  conv[1]=(xx/100)%10+'0';
1587
-  conv[2]=(xx/10)%10+'0';
1588
-  conv[3]='.';
1589
-  conv[4]=(xx)%10+'0';
1590
-  conv[5]=0;
1582
+// Convert float to string with 123.4 format, dropping sign
1583
+char *ftostr31ns(const float &x) {
1584
+  int xx = abs(x * 10);
1585
+  conv[0] = (xx / 1000) % 10 + '0';
1586
+  conv[1] = (xx / 100) % 10 + '0';
1587
+  conv[2] = (xx / 10) % 10 + '0';
1588
+  conv[3] = '.';
1589
+  conv[4] = xx % 10 + '0';
1590
+  conv[5] = 0;
1591 1591
   return conv;
1592 1592
 }
1593 1593
 
1594
-char *ftostr32(const float &x)
1595
-{
1596
-  long xx=x*100;
1597
-  if (xx >= 0)
1598
-    conv[0]=(xx/10000)%10+'0';
1599
-  else
1600
-    conv[0]='-';
1601
-  xx=abs(xx);
1602
-  conv[1]=(xx/1000)%10+'0';
1603
-  conv[2]=(xx/100)%10+'0';
1604
-  conv[3]='.';
1605
-  conv[4]=(xx/10)%10+'0';
1606
-  conv[5]=(xx)%10+'0';
1607
-  conv[6]=0;
1594
+// Convert float to string with 123.4 format
1595
+char *ftostr32(const float &x) {
1596
+  long xx = abs(x * 100);
1597
+  conv[0] = x >= 0 ? (xx / 10000) % 10 + '0' : '-';
1598
+  conv[1] = (xx / 1000) % 10 + '0';
1599
+  conv[2] = (xx / 100) % 10 + '0';
1600
+  conv[3] = '.';
1601
+  conv[4] = (xx / 10) % 10 + '0';
1602
+  conv[5] = xx % 10 + '0';
1603
+  conv[6] = 0;
1608 1604
   return conv;
1609 1605
 }
1610 1606
 
@@ -1625,7 +1621,7 @@ char *ftostr43(const float &x)
1625 1621
 	return conv;
1626 1622
 }
1627 1623
 
1628
-//Float to string with 1.23 format
1624
+// Convert float to string with 1.23 format
1629 1625
 char *ftostr12ns(const float &x)
1630 1626
 {
1631 1627
   long xx=x*100;
@@ -1639,7 +1635,7 @@ char *ftostr12ns(const float &x)
1639 1635
   return conv;
1640 1636
 }
1641 1637
 
1642
-//  convert float to space-padded string with -_23.4_ format
1638
+// Convert float to space-padded string with -_23.4_ format
1643 1639
 char *ftostr32sp(const float &x) {
1644 1640
   long xx = abs(x * 100);
1645 1641
   uint8_t dig;
@@ -1685,58 +1681,51 @@ char *ftostr32sp(const float &x) {
1685 1681
   return conv;
1686 1682
 }
1687 1683
 
1688
-char *itostr31(const int &xx)
1689
-{
1690
-  conv[0]=(xx>=0)?'+':'-';
1691
-  conv[1]=(xx/1000)%10+'0';
1692
-  conv[2]=(xx/100)%10+'0';
1693
-  conv[3]=(xx/10)%10+'0';
1694
-  conv[4]='.';
1695
-  conv[5]=(xx)%10+'0';
1696
-  conv[6]=0;
1684
+// Convert int to lj string with +123.0 format
1685
+char *itostr31(const int &x) {
1686
+  conv[0] = x >= 0 ? '+' : '-';
1687
+  int xx = abs(x);
1688
+  conv[1] = (xx / 100) % 10 + '0';
1689
+  conv[2] = (xx / 10) % 10 + '0';
1690
+  conv[3] = xx % 10 + '0';
1691
+  conv[4] = '.';
1692
+  conv[5] = '0';
1693
+  conv[6] = 0;
1697 1694
   return conv;
1698 1695
 }
1699 1696
 
1700 1697
 // Convert int to rj string with 123 or -12 format
1701
-char *itostr3(const int &x)
1702
-{
1698
+char *itostr3(const int &x) {
1703 1699
   int xx = x;
1704 1700
   if (xx < 0) {
1705
-     conv[0]='-';
1701
+     conv[0] = '-';
1706 1702
      xx = -xx;
1707
-  } else if (xx >= 100)
1708
-    conv[0]=(xx/100)%10+'0';
1709
-  else
1710
-    conv[0]=' ';
1711
-  if (xx >= 10)
1712
-    conv[1]=(xx/10)%10+'0';
1703
+  }
1713 1704
   else
1714
-    conv[1]=' ';
1715
-  conv[2]=(xx)%10+'0';
1716
-  conv[3]=0;
1705
+    conv[0] = xx >= 100 ? (xx / 100) % 10 + '0' : ' ';
1706
+
1707
+  conv[1] = xx >= 10 ? (xx / 10) % 10 + '0' : ' ';
1708
+  conv[2] = xx % 10 + '0';
1709
+  conv[3] = 0;
1717 1710
   return conv;
1718 1711
 }
1719 1712
 
1720 1713
 // Convert int to lj string with 123 format
1721
-char *itostr3left(const int &xx)
1722
-{
1723
-  if (xx >= 100)
1724
-  {
1725
-    conv[0]=(xx/100)%10+'0';
1726
-    conv[1]=(xx/10)%10+'0';
1727
-    conv[2]=(xx)%10+'0';
1728
-    conv[3]=0;
1714
+char *itostr3left(const int &xx) {
1715
+  if (xx >= 100) {
1716
+    conv[0] = (xx / 100) % 10 + '0';
1717
+    conv[1] = (xx / 10) % 10 + '0';
1718
+    conv[2] = xx % 10 + '0';
1719
+    conv[3] = 0;
1729 1720
   }
1730
-  else if (xx >= 10)
1731
-  {
1732
-    conv[0]=(xx/10)%10+'0';
1733
-    conv[1]=(xx)%10+'0';
1734
-    conv[2]=0;
1721
+  else if (xx >= 10) {
1722
+    conv[0] = (xx / 10) % 10 + '0';
1723
+    conv[1] = xx % 10 + '0';
1724
+    conv[2] = 0;
1735 1725
   }
1736
-  else
1737
-  {
1738
-    conv[0]=(xx)%10+'0';
1739
-    conv[1]=0;
1726
+  else {
1727
+    conv[0] = xx % 10 + '0';
1728
+    conv[1] = 0;
1740 1729
   }
1741 1730
   return conv;
1742 1731
 }
@@ -1764,34 +1753,30 @@ char *ftostr5(const float &x) {
1764 1753
 }
1765 1754
 
1766 1755
 // Convert float to string with +1234.5 format
1767
-char *ftostr51(const float &x)
1768
-{
1769
-  long xx=x*10;
1770
-  conv[0]=(xx>=0)?'+':'-';
1771
-  xx=abs(xx);
1772
-  conv[1]=(xx/10000)%10+'0';
1773
-  conv[2]=(xx/1000)%10+'0';
1774
-  conv[3]=(xx/100)%10+'0';
1775
-  conv[4]=(xx/10)%10+'0';
1776
-  conv[5]='.';
1777
-  conv[6]=(xx)%10+'0';
1778
-  conv[7]=0;
1756
+char *ftostr51(const float &x) {
1757
+  long xx = abs(x * 10);
1758
+  conv[0] = (x >= 0) ? '+' : '-';
1759
+  conv[1] = (xx / 10000) % 10 + '0';
1760
+  conv[2] = (xx / 1000) % 10 + '0';
1761
+  conv[3] = (xx / 100) % 10 + '0';
1762
+  conv[4] = (xx / 10) % 10 + '0';
1763
+  conv[5] = '.';
1764
+  conv[6] = xx % 10 + '0';
1765
+  conv[7] = 0;
1779 1766
   return conv;
1780 1767
 }
1781 1768
 
1782 1769
 // Convert float to string with +123.45 format
1783
-char *ftostr52(const float &x)
1784
-{
1785
-  long xx=x*100;
1786
-  conv[0]=(xx>=0)?'+':'-';
1787
-  xx=abs(xx);
1788
-  conv[1]=(xx/10000)%10+'0';
1789
-  conv[2]=(xx/1000)%10+'0';
1790
-  conv[3]=(xx/100)%10+'0';
1791
-  conv[4]='.';
1792
-  conv[5]=(xx/10)%10+'0';
1793
-  conv[6]=(xx)%10+'0';
1794
-  conv[7]=0;
1770
+char *ftostr52(const float &x) {
1771
+  conv[0] = (x >= 0) ? '+' : '-';
1772
+  long xx = abs(x * 100);
1773
+  conv[1] = (xx / 10000) % 10 + '0';
1774
+  conv[2] = (xx / 1000) % 10 + '0';
1775
+  conv[3] = (xx / 100) % 10 + '0';
1776
+  conv[4] = '.';
1777
+  conv[5] = (xx / 10) % 10 + '0';
1778
+  conv[6] = xx % 10 + '0';
1779
+  conv[7] = 0;
1795 1780
   return conv;
1796 1781
 }
1797 1782
 

Laddar…
Avbryt
Spara