Browse Source

indentation

3d-gussner 3 years ago
parent
commit
ae48e7c3ce
2 changed files with 83 additions and 76 deletions
  1. 54 47
      Firmware/Marlin_main.cpp
  2. 29 29
      Firmware/ultralcd.cpp

+ 54 - 47
Firmware/Marlin_main.cpp

@@ -6392,40 +6392,41 @@ Sigma_Exit:
 #endif		// Z_PROBE_REPEATABILITY_TEST 
 #endif		// ENABLE_AUTO_BED_LEVELING
 
-	/*!
-	### M73 - Set/get print progress <a href="https://reprap.org/wiki/G-code#M73:_Set.2FGet_build_percentage">M73: Set/Get build percentage</a>
-	#### Usage
-    
-	    M73 [ P | R | Q | S | C ]
-    
-	#### Parameters
+  /*!
+  ### M73 - Set/get print progress <a href="https://reprap.org/wiki/G-code#M73:_Set.2FGet_build_percentage">M73: Set/Get build percentage</a>
+  #### Usage
+  
+      M73 [ P | R | Q | S | C ]
+
+  #### Parameters
     - `P` - Percent in normal mode
     - `R` - Time remaining in normal mode
     - `Q` - Percent in silent mode
     - `S` - Time in silent mode
     - `C` - Time to change/pause/user interaction
-   */
-	case 73: //M73 show percent done and time remaining
-		if(code_seen('P')) print_percent_done_normal = code_value();
-		if(code_seen('R')) print_time_remaining_normal = code_value();
-		if(code_seen('Q')) print_percent_done_silent = code_value();
-		if(code_seen('S')) print_time_remaining_silent = code_value();
+  */
+  //!@todo update RepRap Gcode wiki
+  case 73: //M73 show percent done and time remaining
+  {	
+    if(code_seen('P')) print_percent_done_normal = code_value();
+    if(code_seen('R')) print_time_remaining_normal = code_value();
+    if(code_seen('Q')) print_percent_done_silent = code_value();
+    if(code_seen('S')) print_time_remaining_silent = code_value();
 
-		{
-			const char* _msg_mode_done_remain = _N("%S MODE: Percent done: %d; print time remaining in mins: %d\n");
-			printf_P(_msg_mode_done_remain, _N("NORMAL"), int(print_percent_done_normal), print_time_remaining_normal);
-			printf_P(_msg_mode_done_remain, _N("SILENT"), int(print_percent_done_silent), print_time_remaining_silent);
-		}
+    {
+      const char* _msg_mode_done_remain = _N("%S MODE: Percent done: %d; print time remaining in mins: %d\n");
+      printf_P(_msg_mode_done_remain, _N("NORMAL"), int(print_percent_done_normal), print_time_remaining_normal);
+      printf_P(_msg_mode_done_remain, _N("SILENT"), int(print_percent_done_silent), print_time_remaining_silent);
+    }
 
     print_time_to_change = PRINT_TIME_REMAINING_INIT;
- 		if(code_seen('C')) 
+    if(code_seen('C')) 
     {
       print_time_to_change = code_value();
-		  printf_P(_N("Time to next change in mins: %d\n"), print_time_to_change);
-	  }
-
-		break;
-
+      printf_P(_N("Time to next change in mins: %d\n"), print_time_to_change);
+    }
+    break;
+  }
     /*!
 	### M104 - Set hotend temperature <a href="https://reprap.org/wiki/G-code#M104:_Set_Extruder_Temperature">M104: Set Extruder Temperature</a>
 	#### Usage
@@ -11663,50 +11664,56 @@ void print_mesh_bed_leveling_table()
   SERIAL_ECHOLN();
 }
 
-uint16_t print_time_remaining() {
-	uint16_t print_t = PRINT_TIME_REMAINING_INIT;
+uint16_t print_time_remaining()
+{
+  uint16_t print_t = PRINT_TIME_REMAINING_INIT;
 #ifdef TMC2130 
-	if (SilentModeMenu == SILENT_MODE_OFF) print_t = print_time_remaining_normal;
-	else print_t = print_time_remaining_silent;
+  if (SilentModeMenu == SILENT_MODE_OFF) print_t = print_time_remaining_normal;
+  else print_t = print_time_remaining_silent;
 #else
-	print_t = print_time_remaining_normal;
+  print_t = print_time_remaining_normal;
 #endif //TMC2130
-	if ((print_t != PRINT_TIME_REMAINING_INIT) && (feedmultiply != 0)) print_t = 100ul * print_t / feedmultiply;
-	return print_t;
+  if ((print_t != PRINT_TIME_REMAINING_INIT) && (feedmultiply != 0)) print_t = 100ul * print_t / feedmultiply;
+  return print_t;
 }
 
-uint16_t print_time_to_change_remaining() {
-	uint16_t print_t = PRINT_TIME_REMAINING_INIT;
+uint16_t print_time_to_change_remaining()
+{
+  uint16_t print_t = PRINT_TIME_REMAINING_INIT;
 #ifdef TMC2130 
-	if (SilentModeMenu == SILENT_MODE_OFF) print_t = print_time_to_change;
+  if (SilentModeMenu == SILENT_MODE_OFF) print_t = print_time_to_change;
   else print_t = print_time_to_change - (print_time_remaining_normal - print_time_remaining_silent);
 #else
   print_t = print_time_to_change;
 #endif //TMC2130
-	if ((print_t != PRINT_TIME_REMAINING_INIT) && (feedmultiply != 0)) print_t = 100ul * print_t / feedmultiply;
-	return print_t;
+  if ((print_t != PRINT_TIME_REMAINING_INIT) && (feedmultiply != 0)) print_t = 100ul * print_t / feedmultiply;
+  return print_t;
 }
 
 uint8_t calc_percent_done()
 {
-	//in case that we have information from M73 gcode return percentage counted by slicer, else return percentage counted as byte_printed/filesize
-	uint8_t percent_done = 0;
+  //in case that we have information from M73 gcode return percentage counted by slicer, else return percentage counted as byte_printed/filesize
+  uint8_t percent_done = 0;
 #ifdef TMC2130
-	if (SilentModeMenu == SILENT_MODE_OFF && print_percent_done_normal <= 100) {
-		percent_done = print_percent_done_normal;
-	}
-	else if (print_percent_done_silent <= 100) {
+  if (SilentModeMenu == SILENT_MODE_OFF && print_percent_done_normal <= 100)
+  {
+    percent_done = print_percent_done_normal;
+  }
+	else if (print_percent_done_silent <= 100)
+  {
 		percent_done = print_percent_done_silent;
 	}
 #else
-	if (print_percent_done_normal <= 100) {
+	if (print_percent_done_normal <= 100)
+  {
 		percent_done = print_percent_done_normal;
 	}
 #endif //TMC2130
-	else {
-		percent_done = card.percentDone();
-	}
-	return percent_done;
+  else
+  {
+    percent_done = card.percentDone();
+  }
+  return percent_done;
 }
 
 static void print_time_remaining_init()

+ 29 - 29
Firmware/ultralcd.cpp

@@ -671,39 +671,39 @@ void lcdui_print_cmd_diag(void)
 // Print time (8 chars total)
 void lcdui_print_time(void)
 {
-	//if remaining print time estimation is available print it else print elapsed time
-	uint16_t print_t = 0;
-	int chars = 0;
+    //if remaining print time estimation is available print it else print elapsed time
+    uint16_t print_t = 0;
+    int chars = 0;
     char suff = ' ';
     char suff_doubt = ' ';
 
-	if(print_time_to_change != PRINT_TIME_REMAINING_INIT)
-	{
-		print_t = print_time_to_change_remaining();
-		suff = 'C';
-		if (feedmultiply != 100)
-                    suff_doubt = '?';
-	}
-	else if (print_time_remaining_normal != PRINT_TIME_REMAINING_INIT)
-	{
-		print_t = print_time_remaining();
-		suff = 'R';
-		if (feedmultiply != 100)
-                    suff_doubt = '?';
-	}
-	else if(starttime != 0)
-		print_t = _millis() / 60000 - starttime / 60000;
+    if(print_time_to_change != PRINT_TIME_REMAINING_INIT)
+    {
+        print_t = print_time_to_change_remaining();
+        suff = 'C';
+        if (feedmultiply != 100)
+            suff_doubt = '?';
+    }
+    else if (print_time_remaining_normal != PRINT_TIME_REMAINING_INIT)
+    {
+        print_t = print_time_remaining();
+        suff = 'R';
+        if (feedmultiply != 100)
+            suff_doubt = '?';
+    }
+    else if(starttime != 0)
+        print_t = _millis() / 60000 - starttime / 60000;
 
-	if ((PRINTER_ACTIVE) && ((print_time_remaining_normal != PRINT_TIME_REMAINING_INIT) || (print_time_to_change != PRINT_TIME_REMAINING_INIT) || (starttime != 0)))
-	{
- 		if (print_t < 6000) //time<100h
-			chars = lcd_printf_P(_N("%c%02u:%02u%c%c"), LCD_STR_CLOCK[0], print_t / 60, print_t % 60, suff, suff_doubt);
-		else //time>=100h
-			chars = lcd_printf_P(_N("%c%3uh %c%c"), LCD_STR_CLOCK[0], print_t / 60, suff, suff_doubt);
-	}
-	else
-		chars = lcd_printf_P(_N("%c--:--  "), LCD_STR_CLOCK[0]);
-	lcd_space(8 - chars);
+    if ((PRINTER_ACTIVE) && ((print_time_remaining_normal != PRINT_TIME_REMAINING_INIT) || (print_time_to_change != PRINT_TIME_REMAINING_INIT) || (starttime != 0)))
+    {
+        if (print_t < 6000) //time<100h
+            chars = lcd_printf_P(_N("%c%02u:%02u%c%c"), LCD_STR_CLOCK[0], print_t / 60, print_t % 60, suff, suff_doubt);
+        else //time>=100h
+            chars = lcd_printf_P(_N("%c%3uh %c%c"), LCD_STR_CLOCK[0], print_t / 60, suff, suff_doubt);
+    }
+    else
+        chars = lcd_printf_P(_N("%c--:--  "), LCD_STR_CLOCK[0]);
+    lcd_space(8 - chars);
 }
 
 //Print status line on status screen