|
@@ -995,7 +995,7 @@ void lcd_cooldown() {
|
995
|
995
|
// Show message above on clicks instead
|
996
|
996
|
if (lcdDrawUpdate) {
|
997
|
997
|
float v = current_position[Z_AXIS] - MESH_HOME_SEARCH_Z;
|
998
|
|
- lcd_implementation_drawedit(PSTR(MSG_MOVE_Z), ftostr43(v + (v < 0 ? -0.0001 : 0.0001), '+'));
|
|
998
|
+ lcd_implementation_drawedit(PSTR(MSG_MOVE_Z), ftostr43sign(v + (v < 0 ? -0.0001 : 0.0001), '+'));
|
999
|
999
|
}
|
1000
|
1000
|
|
1001
|
1001
|
}
|
|
@@ -1237,7 +1237,7 @@ static void _lcd_move(const char* name, AxisEnum axis, float min, float max) {
|
1237
|
1237
|
manual_move_to_current(axis);
|
1238
|
1238
|
lcdDrawUpdate = LCDVIEW_REDRAW_NOW;
|
1239
|
1239
|
}
|
1240
|
|
- if (lcdDrawUpdate) lcd_implementation_drawedit(name, ftostr31(current_position[axis]));
|
|
1240
|
+ if (lcdDrawUpdate) lcd_implementation_drawedit(name, ftostr41sign(current_position[axis]));
|
1241
|
1241
|
if (LCD_CLICKED) lcd_goto_previous_menu(true);
|
1242
|
1242
|
}
|
1243
|
1243
|
#if ENABLED(DELTA)
|
|
@@ -1282,7 +1282,7 @@ static void lcd_move_e(
|
1282
|
1282
|
#endif //EXTRUDERS > 2
|
1283
|
1283
|
}
|
1284
|
1284
|
#endif //EXTRUDERS > 1
|
1285
|
|
- lcd_implementation_drawedit(pos_label, ftostr31(current_position[E_AXIS]));
|
|
1285
|
+ lcd_implementation_drawedit(pos_label, ftostr41sign(current_position[E_AXIS]));
|
1286
|
1286
|
}
|
1287
|
1287
|
if (LCD_CLICKED) lcd_goto_previous_menu(true);
|
1288
|
1288
|
#if EXTRUDERS > 1
|
|
@@ -1913,11 +1913,11 @@ static void lcd_control_volumetric_menu() {
|
1913
|
1913
|
menu_edit_type(int, int3, itostr3, 1);
|
1914
|
1914
|
menu_edit_type(float, float3, ftostr3, 1);
|
1915
|
1915
|
menu_edit_type(float, float32, ftostr32, 100);
|
1916
|
|
-menu_edit_type(float, float43, ftostr43, 1000);
|
1917
|
|
-menu_edit_type(float, float5, ftostr5, 0.01);
|
1918
|
|
-menu_edit_type(float, float51, ftostr51, 10);
|
1919
|
|
-menu_edit_type(float, float52, ftostr52, 100);
|
1920
|
|
-menu_edit_type(unsigned long, long5, ftostr5, 0.01);
|
|
1916
|
+menu_edit_type(float, float43, ftostr43sign, 1000);
|
|
1917
|
+menu_edit_type(float, float5, ftostr5rj, 0.01);
|
|
1918
|
+menu_edit_type(float, float51, ftostr51sign, 10);
|
|
1919
|
+menu_edit_type(float, float52, ftostr52sign, 100);
|
|
1920
|
+menu_edit_type(unsigned long, long5, ftostr5rj, 0.01);
|
1921
|
1921
|
|
1922
|
1922
|
/**
|
1923
|
1923
|
*
|
|
@@ -2382,7 +2382,7 @@ void set_utf_strlen(char* s, uint8_t n) {
|
2382
|
2382
|
i++;
|
2383
|
2383
|
}
|
2384
|
2384
|
while (j++ < n) s[i++] = ' ';
|
2385
|
|
- s[i] = 0;
|
|
2385
|
+ s[i] = '\0';
|
2386
|
2386
|
}
|
2387
|
2387
|
|
2388
|
2388
|
bool lcd_hasstatus() { return (lcd_status_message[0] != '\0'); }
|
|
@@ -2556,6 +2556,9 @@ void lcd_reset_alert_level() { lcd_status_message_level = 0; }
|
2556
|
2556
|
/** Number to string conversion **/
|
2557
|
2557
|
/*********************************/
|
2558
|
2558
|
|
|
2559
|
+#define DIGIT(n) ('0' + (n))
|
|
2560
|
+#define DIGIMOD(n) DIGIT((n) % 10)
|
|
2561
|
+
|
2559
|
2562
|
char conv[8];
|
2560
|
2563
|
|
2561
|
2564
|
// Convert float to rj string with 123 or -12 format
|
|
@@ -2568,52 +2571,40 @@ char *ftostr4sign(const float& x) { return itostr4sign((int)x); }
|
2568
|
2571
|
char* itostr2(const uint8_t& x) {
|
2569
|
2572
|
//sprintf(conv,"%5.1f",x);
|
2570
|
2573
|
int xx = x;
|
2571
|
|
- conv[0] = (xx / 10) % 10 + '0';
|
2572
|
|
- conv[1] = xx % 10 + '0';
|
2573
|
|
- conv[2] = 0;
|
|
2574
|
+ conv[0] = DIGIMOD(xx / 10);
|
|
2575
|
+ conv[1] = DIGIMOD(xx);
|
|
2576
|
+ conv[2] = '\0';
|
2574
|
2577
|
return conv;
|
2575
|
2578
|
}
|
2576
|
2579
|
|
2577
|
2580
|
// Convert float to string with +123.4 / -123.4 format
|
2578
|
|
-char* ftostr31(const float& x) {
|
2579
|
|
- int xx = abs(x * 10);
|
2580
|
|
- conv[0] = (x >= 0) ? '+' : '-';
|
2581
|
|
- conv[1] = (xx / 1000) % 10 + '0';
|
2582
|
|
- conv[2] = (xx / 100) % 10 + '0';
|
2583
|
|
- conv[3] = (xx / 10) % 10 + '0';
|
|
2581
|
+char* ftostr41sign(const float& x) {
|
|
2582
|
+ int xx = int(abs(x * 10)) % 10000;
|
|
2583
|
+ conv[0] = x >= 0 ? '+' : '-';
|
|
2584
|
+ conv[1] = DIGIMOD(xx / 1000);
|
|
2585
|
+ conv[2] = DIGIMOD(xx / 100);
|
|
2586
|
+ conv[3] = DIGIMOD(xx / 10);
|
2584
|
2587
|
conv[4] = '.';
|
2585
|
|
- conv[5] = xx % 10 + '0';
|
2586
|
|
- conv[6] = 0;
|
2587
|
|
- return conv;
|
2588
|
|
-}
|
2589
|
|
-
|
2590
|
|
-// Convert unsigned float to string with 123.4 format, dropping sign
|
2591
|
|
-char* ftostr31ns(const float& x) {
|
2592
|
|
- int xx = abs(x * 10);
|
2593
|
|
- conv[0] = (xx / 1000) % 10 + '0';
|
2594
|
|
- conv[1] = (xx / 100) % 10 + '0';
|
2595
|
|
- conv[2] = (xx / 10) % 10 + '0';
|
2596
|
|
- conv[3] = '.';
|
2597
|
|
- conv[4] = xx % 10 + '0';
|
2598
|
|
- conv[5] = 0;
|
|
2588
|
+ conv[5] = DIGIMOD(xx);
|
|
2589
|
+ conv[6] = '\0';
|
2599
|
2590
|
return conv;
|
2600
|
2591
|
}
|
2601
|
2592
|
|
2602
|
2593
|
// Convert signed float to string with 023.45 / -23.45 format
|
2603
|
2594
|
char *ftostr32(const float& x) {
|
2604
|
2595
|
long xx = abs(x * 100);
|
2605
|
|
- conv[0] = x >= 0 ? (xx / 10000) % 10 + '0' : '-';
|
2606
|
|
- conv[1] = (xx / 1000) % 10 + '0';
|
2607
|
|
- conv[2] = (xx / 100) % 10 + '0';
|
|
2596
|
+ conv[0] = x >= 0 ? DIGIMOD(xx / 10000) : '-';
|
|
2597
|
+ conv[1] = DIGIMOD(xx / 1000);
|
|
2598
|
+ conv[2] = DIGIMOD(xx / 100);
|
2608
|
2599
|
conv[3] = '.';
|
2609
|
|
- conv[4] = (xx / 10) % 10 + '0';
|
2610
|
|
- conv[5] = xx % 10 + '0';
|
2611
|
|
- conv[6] = 0;
|
|
2600
|
+ conv[4] = DIGIMOD(xx / 10);
|
|
2601
|
+ conv[5] = DIGIMOD(xx);
|
|
2602
|
+ conv[6] = '\0';
|
2612
|
2603
|
return conv;
|
2613
|
2604
|
}
|
2614
|
2605
|
|
2615
|
2606
|
// Convert signed float to string (6 digit) with -1.234 / _0.000 / +1.234 format
|
2616
|
|
-char* ftostr43(const float& x, char plus/*=' '*/) {
|
|
2607
|
+char* ftostr43sign(const float& x, char plus/*=' '*/) {
|
2617
|
2608
|
long xx = x * 1000;
|
2618
|
2609
|
if (xx == 0)
|
2619
|
2610
|
conv[0] = ' ';
|
|
@@ -2623,12 +2614,12 @@ char* ftostr43(const float& x, char plus/*=' '*/) {
|
2623
|
2614
|
xx = -xx;
|
2624
|
2615
|
conv[0] = '-';
|
2625
|
2616
|
}
|
2626
|
|
- conv[1] = (xx / 1000) % 10 + '0';
|
|
2617
|
+ conv[1] = DIGIMOD(xx / 1000);
|
2627
|
2618
|
conv[2] = '.';
|
2628
|
|
- conv[3] = (xx / 100) % 10 + '0';
|
2629
|
|
- conv[4] = (xx / 10) % 10 + '0';
|
2630
|
|
- conv[5] = (xx) % 10 + '0';
|
2631
|
|
- conv[6] = 0;
|
|
2619
|
+ conv[3] = DIGIMOD(xx / 100);
|
|
2620
|
+ conv[4] = DIGIMOD(xx / 10);
|
|
2621
|
+ conv[5] = DIGIMOD(xx);
|
|
2622
|
+ conv[6] = '\0';
|
2632
|
2623
|
return conv;
|
2633
|
2624
|
}
|
2634
|
2625
|
|
|
@@ -2636,57 +2627,11 @@ char* ftostr43(const float& x, char plus/*=' '*/) {
|
2636
|
2627
|
char* ftostr12ns(const float& x) {
|
2637
|
2628
|
long xx = x * 100;
|
2638
|
2629
|
xx = abs(xx);
|
2639
|
|
- conv[0] = (xx / 100) % 10 + '0';
|
|
2630
|
+ conv[0] = DIGIMOD(xx / 100);
|
2640
|
2631
|
conv[1] = '.';
|
2641
|
|
- conv[2] = (xx / 10) % 10 + '0';
|
2642
|
|
- conv[3] = (xx) % 10 + '0';
|
2643
|
|
- conv[4] = 0;
|
2644
|
|
- return conv;
|
2645
|
|
-}
|
2646
|
|
-
|
2647
|
|
-// Convert signed float to space-padded string with -_23.4_ format
|
2648
|
|
-char* ftostr32sp(const float& x) {
|
2649
|
|
- long xx = x * 100;
|
2650
|
|
- uint8_t dig;
|
2651
|
|
- if (xx < 0) { // negative val = -_0
|
2652
|
|
- xx = -xx;
|
2653
|
|
- conv[0] = '-';
|
2654
|
|
- dig = (xx / 1000) % 10;
|
2655
|
|
- conv[1] = dig ? '0' + dig : ' ';
|
2656
|
|
- }
|
2657
|
|
- else { // positive val = __0
|
2658
|
|
- dig = (xx / 10000) % 10;
|
2659
|
|
- if (dig) {
|
2660
|
|
- conv[0] = '0' + dig;
|
2661
|
|
- conv[1] = '0' + (xx / 1000) % 10;
|
2662
|
|
- }
|
2663
|
|
- else {
|
2664
|
|
- conv[0] = ' ';
|
2665
|
|
- dig = (xx / 1000) % 10;
|
2666
|
|
- conv[1] = dig ? '0' + dig : ' ';
|
2667
|
|
- }
|
2668
|
|
- }
|
2669
|
|
-
|
2670
|
|
- conv[2] = '0' + (xx / 100) % 10; // lsd always
|
2671
|
|
-
|
2672
|
|
- dig = xx % 10;
|
2673
|
|
- if (dig) { // 2 decimal places
|
2674
|
|
- conv[5] = '0' + dig;
|
2675
|
|
- conv[4] = '0' + (xx / 10) % 10;
|
2676
|
|
- conv[3] = '.';
|
2677
|
|
- }
|
2678
|
|
- else { // 1 or 0 decimal place
|
2679
|
|
- dig = (xx / 10) % 10;
|
2680
|
|
- if (dig) {
|
2681
|
|
- conv[4] = '0' + dig;
|
2682
|
|
- conv[3] = '.';
|
2683
|
|
- }
|
2684
|
|
- else {
|
2685
|
|
- conv[3] = conv[4] = ' ';
|
2686
|
|
- }
|
2687
|
|
- conv[5] = ' ';
|
2688
|
|
- }
|
2689
|
|
- conv[6] = '\0';
|
|
2632
|
+ conv[2] = DIGIMOD(xx / 10);
|
|
2633
|
+ conv[3] = DIGIMOD(xx);
|
|
2634
|
+ conv[4] = '\0';
|
2690
|
2635
|
return conv;
|
2691
|
2636
|
}
|
2692
|
2637
|
|
|
@@ -2701,12 +2646,12 @@ char* itostr3sign(const int& x) {
|
2701
|
2646
|
conv[0] = '-';
|
2702
|
2647
|
xx = -x;
|
2703
|
2648
|
}
|
2704
|
|
- conv[1] = (xx / 100) % 10 + '0';
|
2705
|
|
- conv[2] = (xx / 10) % 10 + '0';
|
2706
|
|
- conv[3] = xx % 10 + '0';
|
|
2649
|
+ conv[1] = DIGIMOD(xx / 100);
|
|
2650
|
+ conv[2] = DIGIMOD(xx / 10);
|
|
2651
|
+ conv[3] = DIGIMOD(xx);
|
2707
|
2652
|
conv[4] = '.';
|
2708
|
2653
|
conv[5] = '0';
|
2709
|
|
- conv[6] = 0;
|
|
2654
|
+ conv[6] = '\0';
|
2710
|
2655
|
return conv;
|
2711
|
2656
|
}
|
2712
|
2657
|
|
|
@@ -2718,56 +2663,46 @@ char* itostr3(const int& x) {
|
2718
|
2663
|
xx = -xx;
|
2719
|
2664
|
}
|
2720
|
2665
|
else
|
2721
|
|
- conv[0] = xx >= 100 ? (xx / 100) % 10 + '0' : ' ';
|
|
2666
|
+ conv[0] = xx >= 100 ? DIGIMOD(xx / 100) : ' ';
|
2722
|
2667
|
|
2723
|
|
- conv[1] = xx >= 10 ? (xx / 10) % 10 + '0' : ' ';
|
2724
|
|
- conv[2] = xx % 10 + '0';
|
2725
|
|
- conv[3] = 0;
|
|
2668
|
+ conv[1] = xx >= 10 ? DIGIMOD(xx / 10) : ' ';
|
|
2669
|
+ conv[2] = DIGIMOD(xx);
|
|
2670
|
+ conv[3] = '\0';
|
2726
|
2671
|
return conv;
|
2727
|
2672
|
}
|
2728
|
2673
|
|
2729
|
2674
|
// Convert unsigned int to lj string with 123 format
|
2730
|
|
-char* itostr3left(const int& x) {
|
2731
|
|
- if (x >= 100) {
|
2732
|
|
- conv[0] = (x / 100) % 10 + '0';
|
2733
|
|
- conv[1] = (x / 10) % 10 + '0';
|
2734
|
|
- conv[2] = x % 10 + '0';
|
2735
|
|
- conv[3] = 0;
|
2736
|
|
- }
|
2737
|
|
- else if (x >= 10) {
|
2738
|
|
- conv[0] = (x / 10) % 10 + '0';
|
2739
|
|
- conv[1] = x % 10 + '0';
|
2740
|
|
- conv[2] = 0;
|
|
2675
|
+char* itostr3left(const int& xx) {
|
|
2676
|
+ if (xx >= 100) {
|
|
2677
|
+ conv[0] = DIGIMOD(xx / 100);
|
|
2678
|
+ conv[1] = DIGIMOD(xx / 10);
|
|
2679
|
+ conv[2] = DIGIMOD(xx);
|
|
2680
|
+ conv[3] = '\0';
|
|
2681
|
+ }
|
|
2682
|
+ else if (xx >= 10) {
|
|
2683
|
+ conv[0] = DIGIMOD(xx / 10);
|
|
2684
|
+ conv[1] = DIGIMOD(xx);
|
|
2685
|
+ conv[2] = '\0';
|
2741
|
2686
|
}
|
2742
|
2687
|
else {
|
2743
|
|
- conv[0] = x % 10 + '0';
|
2744
|
|
- conv[1] = 0;
|
|
2688
|
+ conv[0] = DIGIMOD(xx);
|
|
2689
|
+ conv[1] = '\0';
|
2745
|
2690
|
}
|
2746
|
2691
|
return conv;
|
2747
|
2692
|
}
|
2748
|
2693
|
|
2749
|
|
-// Convert unsigned int to rj string with 1234 format
|
2750
|
|
-char* itostr4(const int& x) {
|
2751
|
|
- conv[0] = x >= 1000 ? (x / 1000) % 10 + '0' : ' ';
|
2752
|
|
- conv[1] = x >= 100 ? (x / 100) % 10 + '0' : ' ';
|
2753
|
|
- conv[2] = x >= 10 ? (x / 10) % 10 + '0' : ' ';
|
2754
|
|
- conv[3] = x % 10 + '0';
|
2755
|
|
- conv[4] = 0;
|
2756
|
|
- return conv;
|
2757
|
|
-}
|
2758
|
|
-
|
2759
|
2694
|
// Convert signed int to rj string with _123, -123, _-12, or __-1 format
|
2760
|
2695
|
char *itostr4sign(const int& x) {
|
2761
|
2696
|
int xx = abs(x);
|
2762
|
2697
|
int sign = 0;
|
2763
|
2698
|
if (xx >= 100) {
|
2764
|
|
- conv[1] = (xx / 100) % 10 + '0';
|
2765
|
|
- conv[2] = (xx / 10) % 10 + '0';
|
|
2699
|
+ conv[1] = DIGIMOD(xx / 100);
|
|
2700
|
+ conv[2] = DIGIMOD(xx / 10);
|
2766
|
2701
|
}
|
2767
|
2702
|
else if (xx >= 10) {
|
2768
|
2703
|
conv[0] = ' ';
|
2769
|
2704
|
sign = 1;
|
2770
|
|
- conv[2] = (xx / 10) % 10 + '0';
|
|
2705
|
+ conv[2] = DIGIMOD(xx / 10);
|
2771
|
2706
|
}
|
2772
|
2707
|
else {
|
2773
|
2708
|
conv[0] = ' ';
|
|
@@ -2775,48 +2710,94 @@ char *itostr4sign(const int& x) {
|
2775
|
2710
|
sign = 2;
|
2776
|
2711
|
}
|
2777
|
2712
|
conv[sign] = x < 0 ? '-' : ' ';
|
2778
|
|
- conv[3] = xx % 10 + '0';
|
2779
|
|
- conv[4] = 0;
|
|
2713
|
+ conv[3] = DIGIMOD(xx);
|
|
2714
|
+ conv[4] = '\0';
|
2780
|
2715
|
return conv;
|
2781
|
2716
|
}
|
2782
|
2717
|
|
2783
|
2718
|
// Convert unsigned float to rj string with 12345 format
|
2784
|
|
-char* ftostr5(const float& x) {
|
|
2719
|
+char* ftostr5rj(const float& x) {
|
2785
|
2720
|
long xx = abs(x);
|
2786
|
|
- conv[0] = xx >= 10000 ? (xx / 10000) % 10 + '0' : ' ';
|
2787
|
|
- conv[1] = xx >= 1000 ? (xx / 1000) % 10 + '0' : ' ';
|
2788
|
|
- conv[2] = xx >= 100 ? (xx / 100) % 10 + '0' : ' ';
|
2789
|
|
- conv[3] = xx >= 10 ? (xx / 10) % 10 + '0' : ' ';
|
2790
|
|
- conv[4] = xx % 10 + '0';
|
2791
|
|
- conv[5] = 0;
|
|
2721
|
+ conv[0] = xx >= 10000 ? DIGIMOD(xx / 10000) : ' ';
|
|
2722
|
+ conv[1] = xx >= 1000 ? DIGIMOD(xx / 1000) : ' ';
|
|
2723
|
+ conv[2] = xx >= 100 ? DIGIMOD(xx / 100) : ' ';
|
|
2724
|
+ conv[3] = xx >= 10 ? DIGIMOD(xx / 10) : ' ';
|
|
2725
|
+ conv[4] = DIGIMOD(xx);
|
|
2726
|
+ conv[5] = '\0';
|
2792
|
2727
|
return conv;
|
2793
|
2728
|
}
|
2794
|
2729
|
|
2795
|
2730
|
// Convert signed float to string with +1234.5 format
|
2796
|
|
-char* ftostr51(const float& x) {
|
|
2731
|
+char* ftostr51sign(const float& x) {
|
2797
|
2732
|
long xx = abs(x * 10);
|
2798
|
2733
|
conv[0] = (x >= 0) ? '+' : '-';
|
2799
|
|
- conv[1] = (xx / 10000) % 10 + '0';
|
2800
|
|
- conv[2] = (xx / 1000) % 10 + '0';
|
2801
|
|
- conv[3] = (xx / 100) % 10 + '0';
|
2802
|
|
- conv[4] = (xx / 10) % 10 + '0';
|
|
2734
|
+ conv[1] = DIGIMOD(xx / 10000);
|
|
2735
|
+ conv[2] = DIGIMOD(xx / 1000);
|
|
2736
|
+ conv[3] = DIGIMOD(xx / 100);
|
|
2737
|
+ conv[4] = DIGIMOD(xx / 10);
|
2803
|
2738
|
conv[5] = '.';
|
2804
|
|
- conv[6] = xx % 10 + '0';
|
2805
|
|
- conv[7] = 0;
|
|
2739
|
+ conv[6] = DIGIMOD(xx);
|
|
2740
|
+ conv[7] = '\0';
|
2806
|
2741
|
return conv;
|
2807
|
2742
|
}
|
2808
|
2743
|
|
2809
|
2744
|
// Convert signed float to string with +123.45 format
|
2810
|
|
-char* ftostr52(const float& x) {
|
2811
|
|
- conv[0] = (x >= 0) ? '+' : '-';
|
|
2745
|
+char* ftostr52sign(const float& x) {
|
2812
|
2746
|
long xx = abs(x * 100);
|
2813
|
|
- conv[1] = (xx / 10000) % 10 + '0';
|
2814
|
|
- conv[2] = (xx / 1000) % 10 + '0';
|
2815
|
|
- conv[3] = (xx / 100) % 10 + '0';
|
|
2747
|
+ conv[0] = (x >= 0) ? '+' : '-';
|
|
2748
|
+ conv[1] = DIGIMOD(xx / 10000);
|
|
2749
|
+ conv[2] = DIGIMOD(xx / 1000);
|
|
2750
|
+ conv[3] = DIGIMOD(xx / 100);
|
2816
|
2751
|
conv[4] = '.';
|
2817
|
|
- conv[5] = (xx / 10) % 10 + '0';
|
2818
|
|
- conv[6] = xx % 10 + '0';
|
2819
|
|
- conv[7] = 0;
|
|
2752
|
+ conv[5] = DIGIMOD(xx / 10);
|
|
2753
|
+ conv[6] = DIGIMOD(xx);
|
|
2754
|
+ conv[7] = '\0';
|
|
2755
|
+ return conv;
|
|
2756
|
+}
|
|
2757
|
+
|
|
2758
|
+// Convert signed float to space-padded string with -_23.4_ format
|
|
2759
|
+char* ftostr52sp(const float& x) {
|
|
2760
|
+ long xx = x * 100;
|
|
2761
|
+ uint8_t dig;
|
|
2762
|
+ if (xx < 0) { // negative val = -_0
|
|
2763
|
+ xx = -xx;
|
|
2764
|
+ conv[0] = '-';
|
|
2765
|
+ dig = (xx / 1000) % 10;
|
|
2766
|
+ conv[1] = dig ? DIGIT(dig) : ' ';
|
|
2767
|
+ }
|
|
2768
|
+ else { // positive val = __0
|
|
2769
|
+ dig = (xx / 10000) % 10;
|
|
2770
|
+ if (dig) {
|
|
2771
|
+ conv[0] = DIGIT(dig);
|
|
2772
|
+ conv[1] = DIGIMOD(xx / 1000);
|
|
2773
|
+ }
|
|
2774
|
+ else {
|
|
2775
|
+ conv[0] = ' ';
|
|
2776
|
+ dig = (xx / 1000) % 10;
|
|
2777
|
+ conv[1] = dig ? DIGIT(dig) : ' ';
|
|
2778
|
+ }
|
|
2779
|
+ }
|
|
2780
|
+
|
|
2781
|
+ conv[2] = DIGIMOD(xx / 100); // lsd always
|
|
2782
|
+
|
|
2783
|
+ dig = xx % 10;
|
|
2784
|
+ if (dig) { // 2 decimal places
|
|
2785
|
+ conv[5] = DIGIT(dig);
|
|
2786
|
+ conv[4] = DIGIMOD(xx / 10);
|
|
2787
|
+ conv[3] = '.';
|
|
2788
|
+ }
|
|
2789
|
+ else { // 1 or 0 decimal place
|
|
2790
|
+ dig = (xx / 10) % 10;
|
|
2791
|
+ if (dig) {
|
|
2792
|
+ conv[4] = DIGIT(dig);
|
|
2793
|
+ conv[3] = '.';
|
|
2794
|
+ }
|
|
2795
|
+ else {
|
|
2796
|
+ conv[3] = conv[4] = ' ';
|
|
2797
|
+ }
|
|
2798
|
+ conv[5] = ' ';
|
|
2799
|
+ }
|
|
2800
|
+ conv[6] = '\0';
|
2820
|
2801
|
return conv;
|
2821
|
2802
|
}
|
2822
|
2803
|
|