Browse Source

Change printf_P without format arguments and NL to puts_P only

Voinea Dragos 3 years ago
parent
commit
da21916473
8 changed files with 45 additions and 45 deletions
  1. 4 4
      Firmware/Dcodes.cpp
  2. 9 9
      Firmware/Marlin_main.cpp
  3. 1 1
      Firmware/adc.c
  4. 11 11
      Firmware/fsensor.cpp
  5. 11 11
      Firmware/mmu.cpp
  6. 2 2
      Firmware/tmc2130.cpp
  7. 1 1
      Firmware/uart2.c
  8. 6 6
      Firmware/ultralcd.cpp

+ 4 - 4
Firmware/Dcodes.cpp

@@ -380,7 +380,7 @@ void dcode_4()
    */
 void dcode_5()
 {
-	printf_P(PSTR("D5 - Read/Write FLASH\n"));
+	puts_P(PSTR("D5 - Read/Write FLASH"));
 	uint32_t address = 0x0000; //default 0x0000
 	uint16_t count = 0x0400; //default 0x0400 (1kb block)
 	if (code_seen('A')) // Address (0x00000-0x3ffff)
@@ -481,7 +481,7 @@ void dcode_7()
     */
 void dcode_8()
 {
-	printf_P(PSTR("D8 - Read/Write PINDA\n"));
+	puts_P(PSTR("D8 - Read/Write PINDA"));
 	uint8_t cal_status = calibration_status_pinda();
 	float temp_pinda = current_temperature_pinda;
 	float offset_z = temp_compensation_pinda_thermistor_offset(temp_pinda);
@@ -587,7 +587,7 @@ uint16_t dcode_9_ADC_val(uint8_t i)
 
 void dcode_9()
 {
-	printf_P(PSTR("D9 - Read/Write ADC\n"));
+	puts_P(PSTR("D9 - Read/Write ADC"));
 	if ((strchr_pointer[1+1] == '?') || (strchr_pointer[1+1] == 0))
 	{
 		for (uint8_t i = 0; i < ADC_CHAN_CNT; i++)
@@ -784,7 +784,7 @@ extern void st_synchronize();
 	*/
 void dcode_2130()
 {
-	printf_P(PSTR("D2130 - TMC2130\n"));
+	puts_P(PSTR("D2130 - TMC2130"));
 	uint8_t axis = 0xff;
 	switch (strchr_pointer[1+4])
 	{

+ 9 - 9
Firmware/Marlin_main.cpp

@@ -1019,10 +1019,10 @@ uint8_t lang_xflash_enum_codes(uint16_t* codes)
 		w25x20cl_rd_data(addr, (uint8_t*)&header, sizeof(lang_table_header_t));
 		if (header.magic != LANG_MAGIC)
 		{
-			printf_P(_n("NG!\n"));
+			puts_P(_n("NG!"));
 			break;
 		}
-		printf_P(_n("OK\n"));
+		puts_P(_n("OK"));
 		printf_P(_n(" _lt_magic        = 0x%08lx %S\n"), header.magic, (header.magic==LANG_MAGIC)?_n("OK"):_n("NA"));
 		printf_P(_n(" _lt_size         = 0x%04x (%d)\n"), header.size, header.size);
 		printf_P(_n(" _lt_count        = 0x%04x (%d)\n"), header.count, header.count);
@@ -1132,7 +1132,7 @@ void setup()
 		SERIAL_PROTOCOLLNPGM("start");
 #endif
 	SERIAL_ECHO_START;
-	printf_P(PSTR(" " FW_VERSION_FULL "\n"));
+	puts_P(PSTR(" " FW_VERSION_FULL));
 
 	//SERIAL_ECHOPAIR("Active sheet before:", static_cast<unsigned long int>(eeprom_read_byte(&(EEPROM_Sheets_base->active_sheet))));
 
@@ -1222,12 +1222,12 @@ void setup()
 		printf_P(_n("_SEC_LANG_TABLE checksum = %04x\n"), sum);
 		sum = (sum >> 8) | ((sum & 0xff) << 8); //swap bytes
 		if (sum == header.checksum)
-			printf_P(_n("Checksum OK\n"), sum);
+			puts_P(_n("Checksum OK"), sum);
 		else
-			printf_P(_n("Checksum NG\n"), sum);
+			puts_P(_n("Checksum NG"), sum);
 	}
 	else
-		printf_P(_n("lang_get_header failed!\n"));
+		puts_P(_n("lang_get_header failed!"));
 
 #if 0
 		for (uint16_t i = 0; i < 1024*10; i++)
@@ -1307,7 +1307,7 @@ void setup()
 	else
 	{
 	    w25x20cl_err_msg();
-	    printf_P(_n("W25X20CL not responding.\n"));
+	    puts_P(_n("W25X20CL not responding."));
 	}
 #ifdef EXTRUDER_ALTFAN_DETECT
 	SERIAL_ECHORPGM(_n("Extruder fan type: "));
@@ -5243,12 +5243,12 @@ if(eSoundMode!=e_SOUND_MODE_SILENT)
 					break;
 				}
 				if (MESH_HOME_Z_SEARCH - current_position[Z_AXIS] < 0.1f) {
-					printf_P(PSTR("Bed leveling failed. Sensor disconnected or cable broken.\n"));
+					puts_P(PSTR("Bed leveling failed. Sensor disconnected or cable broken."));
 					break;
 				}
 			}
 			if (has_z && fabs(z0 - current_position[Z_AXIS]) > Z_CALIBRATION_THRESHOLD) { //if we have data from z calibration, max. allowed difference is 1mm for each point
-				printf_P(PSTR("Bed leveling failed. Sensor triggered too high.\n"));
+				puts_P(PSTR("Bed leveling failed. Sensor triggered too high."));
 				break;
 			}
 			#ifdef SUPPORT_VERBOSITY

+ 1 - 1
Firmware/adc.c

@@ -19,7 +19,7 @@ uint16_t adc_sim_mask;
 
 void adc_init(void)
 {
-	printf_P(PSTR("adc_init\n"));
+	puts_P(PSTR("adc_init"));
 	adc_sim_mask = 0x00;
 	ADCSRA |= (1 << ADPS2) | (1 << ADPS1) | (1 << ADPS0);
 	ADMUX |= (1 << REFS0);

+ 11 - 11
Firmware/fsensor.cpp

@@ -129,7 +129,7 @@ unsigned long nIRsensorLastTime;
 
 void fsensor_stop_and_save_print(void)
 {
-    printf_P(PSTR("fsensor_stop_and_save_print\n"));
+    puts_P(PSTR("fsensor_stop_and_save_print"));
     stop_and_save_print_to_ram(0, 0);
     fsensor_watch_runout = false;
 }
@@ -152,7 +152,7 @@ void fsensor_set_axis_steps_per_unit(float u)
 
 void fsensor_restore_print_and_continue(void)
 {
-    printf_P(PSTR("fsensor_restore_print_and_continue\n"));
+    puts_P(PSTR("fsensor_restore_print_and_continue"));
     fsensor_watch_runout = true;
 #ifdef PAT9125
     fsensor_reset_err_cnt();
@@ -164,7 +164,7 @@ void fsensor_restore_print_and_continue(void)
 // allowing new instructions to be inserted in the middle
 void fsensor_checkpoint_print(void)
 {
-    printf_P(PSTR("fsensor_checkpoint_print\n"));
+    puts_P(PSTR("fsensor_checkpoint_print"));
     stop_and_save_print_to_ram(0, 0);
     restore_print_from_ram_and_continue(0);
 }
@@ -414,7 +414,7 @@ void fsensor_oq_meassure_start(uint8_t skip)
 {
 	if (!fsensor_enabled) return;
 	if (!fsensor_oq_meassure_enabled) return;
-	printf_P(PSTR("fsensor_oq_meassure_start\n"));
+	puts_P(PSTR("fsensor_oq_meassure_start"));
 	fsensor_oq_skipchunk = skip;
 	fsensor_oq_samples = 0;
 	fsensor_oq_st_sum = 0;
@@ -447,7 +447,7 @@ bool fsensor_oq_result(void)
 {
 	if (!fsensor_enabled) return true;
 	if (!fsensor_oq_meassure_enabled) return true;
-	printf_P(_N("fsensor_oq_result\n"));
+	puts_P(_N("fsensor_oq_result"));
 	bool res_er_sum = (fsensor_oq_er_sum <= FSENSOR_OQ_MAX_ES);
 	printf_P(_N(" er_sum = %u %S\n"), fsensor_oq_er_sum, (res_er_sum?_OK:_NG));
 	bool res_er_max = (fsensor_oq_er_max <= FSENSOR_OQ_MAX_EM);
@@ -616,7 +616,7 @@ void fsensor_st_block_chunk(int cnt)
 //! Common code for enqueing M600 and supplemental codes into the command queue.
 //! Used both for the IR sensor and the PAT9125
 void fsensor_enque_M600(){
-	printf_P(PSTR("fsensor_update - M600\n"));
+	puts_P(PSTR("fsensor_update - M600"));
 	eeprom_update_byte((uint8_t*)EEPROM_FERROR_COUNT, eeprom_read_byte((uint8_t*)EEPROM_FERROR_COUNT) + 1);
 	eeprom_update_word((uint16_t*)EEPROM_FERROR_COUNT_TOT, eeprom_read_word((uint16_t*)EEPROM_FERROR_COUNT_TOT) + 1);
 	enquecommand_front_P((PSTR("M600")));
@@ -670,7 +670,7 @@ void fsensor_update(void)
                 fsensor_softfail_ccnt = 0;
             if (!err && fsensor_softfail_ccnt <= FSENSOR_SOFTERR_CMAX)
             {
-                printf_P(PSTR("fsensor_err_cnt = 0\n"));
+                puts_P(PSTR("fsensor_err_cnt = 0"));
                 ++fsensor_softfail;
                 ++fsensor_softfail_ccnt;
                 fsensor_softfail_last = now;
@@ -757,19 +757,19 @@ bool fsensor_IR_check(){
         /// Or the user is so creative so that he can hold a piece of fillament in the hole in such a genius way,
         /// that the IR fsensor reading is within 1.5 and 3V ... this would have been highly unusual
         /// and would have been considered more like a sabotage than normal printer operation
-        printf_P(PSTR("fsensor in forbidden range 1.5-3V - check sensor\n"));
+        puts_P(PSTR("fsensor in forbidden range 1.5-3V - check sensor"));
         return false; 
     }
     if( oFsensorPCB == ClFsensorPCB::_Rev04 ){
         /// newer IR sensor cannot normally produce 4.6-5V, this is considered a failure/bad mount
         if( IRsensor_Hopen_TRESHOLD <= current_voltage_raw_IR && current_voltage_raw_IR <= IRsensor_VMax_TRESHOLD ){
-            printf_P(PSTR("fsensor v0.4 in fault range 4.6-5V - unconnected\n"));
+            puts_P(PSTR("fsensor v0.4 in fault range 4.6-5V - unconnected"));
             return false;
         }
         /// newer IR sensor cannot normally produce 0-0.3V, this is considered a failure 
 #if 0	//Disabled as it has to be decided if we gonna use this or not.
         if( IRsensor_Hopen_TRESHOLD <= current_voltage_raw_IR && current_voltage_raw_IR <= IRsensor_VMax_TRESHOLD ){
-            printf_P(PSTR("fsensor v0.4 in fault range 0.0-0.3V - wrong IR sensor\n"));
+            puts_P(PSTR("fsensor v0.4 in fault range 0.0-0.3V - wrong IR sensor"));
             return false;
         }
 #endif
@@ -777,7 +777,7 @@ bool fsensor_IR_check(){
     /// If IR sensor is "uknown state" and filament is not loaded > 1.5V return false
 #if 0
     if( (oFsensorPCB == ClFsensorPCB::_Undef) && ( current_voltage_raw_IR > IRsensor_Lmax_TRESHOLD ) ){
-        printf_P(PSTR("Unknown IR sensor version and no filament loaded detected.\n"));
+        puts_P(PSTR("Unknown IR sensor version and no filament loaded detected."));
         return false;
     }
 #endif

+ 11 - 11
Firmware/mmu.cpp

@@ -567,11 +567,11 @@ bool can_extrude()
 static void get_response_print_info(uint8_t move) {
 	printf_P(PSTR("mmu_get_response - begin move: "), move);
 	switch (move) {
-		case MMU_LOAD_MOVE: printf_P(PSTR("load\n")); break;
-		case MMU_UNLOAD_MOVE: printf_P(PSTR("unload\n")); break;
-		case MMU_TCODE_MOVE: printf_P(PSTR("T-code\n")); break;
-		case MMU_NO_MOVE: printf_P(PSTR("no move\n")); break;
-		default: printf_P(PSTR("error: unknown move\n")); break;
+		case MMU_LOAD_MOVE: puts_P(PSTR("load")); break;
+		case MMU_UNLOAD_MOVE: puts_P(PSTR("unload")); break;
+		case MMU_TCODE_MOVE: puts_P(PSTR("T-code")); break;
+		case MMU_NO_MOVE: puts_P(PSTR("no move")); break;
+		default: puts_P(PSTR("error: unknown move")); break;
 	}
 }
 
@@ -602,7 +602,7 @@ bool mmu_get_response(uint8_t move)
 				{
 				    if (can_extrude())
 				    {
-                        printf_P(PSTR("Unload 1\n"));
+                        puts_P(PSTR("Unload 1"));
                         current_position[E_AXIS] = current_position[E_AXIS] - MMU_LOAD_FEEDRATE * MMU_LOAD_TIME_MS*0.001;
                         plan_buffer_line_curposXYZE(MMU_LOAD_FEEDRATE);
                         st_synchronize();
@@ -610,7 +610,7 @@ bool mmu_get_response(uint8_t move)
 				}
 				else //filament was unloaded from idler, no additional movements needed 
 				{ 
-					printf_P(PSTR("Unloading finished 1\n"));
+					puts_P(PSTR("Unloading finished 1"));
 					disable_e0(); //turn off E-stepper to prevent overheating and alow filament pull-out if necessary
 					move = MMU_NO_MOVE;
 				}
@@ -620,7 +620,7 @@ bool mmu_get_response(uint8_t move)
 				{
                     if (can_extrude())
                     {
-                        printf_P(PSTR("Unload 2\n"));
+                        puts_P(PSTR("Unload 2"));
                         current_position[E_AXIS] = current_position[E_AXIS] - MMU_LOAD_FEEDRATE * MMU_LOAD_TIME_MS*0.001;
                         plan_buffer_line_curposXYZE(MMU_LOAD_FEEDRATE);
                         st_synchronize();
@@ -628,7 +628,7 @@ bool mmu_get_response(uint8_t move)
 				}
 				else //delay to allow mmu unit to pull out filament from bondtech gears and then start with infinite loading 
 				{ 
-					printf_P(PSTR("Unloading finished 2\n"));
+					puts_P(PSTR("Unloading finished 2"));
 					disable_e0(); //turn off E-stepper to prevent overheating and alow filament pull-out if necessary
 					delay_keep_alive(MMU_LOAD_TIME_MS);
 					move = MMU_LOAD_MOVE;
@@ -689,7 +689,7 @@ void manage_response(bool move_axes, bool turn_off_nozzle, uint8_t move)
 				  }
 				  st_synchronize();
 				  mmu_print_saved = true;
-				  printf_P(PSTR("MMU not responding\n"));
+				  puts_P(PSTR("MMU not responding"));
 				  KEEPALIVE_STATE(PAUSED_FOR_USER);
 				  hotend_temp_bckp = degTargetHotend(active_extruder);
 				  if (move_axes) {
@@ -746,7 +746,7 @@ void manage_response(bool move_axes, bool turn_off_nozzle, uint8_t move)
 			  }
 		  }
 		  else if (mmu_print_saved) {
-			  printf_P(PSTR("MMU starts responding\n"));
+			  puts_P(PSTR("MMU starts responding"));
 			  KEEPALIVE_STATE(IN_HANDLER);
 			  mmu_loading_flag = false;
 			  if (turn_off_nozzle) 

+ 2 - 2
Firmware/tmc2130.cpp

@@ -996,11 +996,11 @@ bool tmc2130_home_calibrate(uint8_t axis)
 	uint8_t val[16];
 	homeaxis(axis, 16, step);
 	bubblesort_uint8(step, 16, 0);
-	printf_P(PSTR("sorted samples:\n"));
+	puts_P(PSTR("sorted samples:"));
 	for (uint8_t i = 0; i < 16; i++)
 		printf_P(PSTR(" i=%2d step=%2d\n"), i, step[i]);
 	uint8_t cl = clusterize_uint8(step, 16, cnt, val, 1);
-	printf_P(PSTR("clusters:\n"));
+	puts_P(PSTR("clusters:"));
 	for (uint8_t i = 0; i < cl; i++)
 		printf_P(PSTR(" i=%2d cnt=%2d val=%2d\n"), i, cnt[i], val[i]);
 	bubblesort_uint8(cnt, cl, val);

+ 1 - 1
Firmware/uart2.c

@@ -79,7 +79,7 @@ ISR(USART2_RX_vect)
 	if (rbuf_put(uart2_ibuf, UDR2) < 0) // put received byte to buffer
 	{ //rx buffer full
 		//uart2_rx_clr(); //for sure, clear input buffer
-		printf_P(PSTR("USART2 rx Full!!!\n"));
+		puts_P(PSTR("USART2 rx Full!!!"));
 	}
 }
 

+ 6 - 6
Firmware/ultralcd.cpp

@@ -8629,9 +8629,9 @@ static FanCheck lcd_selftest_fan_auto(int _fan)
 		setExtruderAutoFanState(0); //extruder fan
 		manage_heater();			//count average fan speed from 2s delay and turn off fans
 
-		printf_P(PSTR("Test 1:\n"));
-		printf_P(PSTR("Print fan speed: %d \n"), fan_speed[1]);
-		printf_P(PSTR("Extr fan speed: %d \n"), fan_speed[0]);
+		puts_P(PSTR("Test 1:"));
+		printf_P(PSTR("Print fan speed: %d\n"), fan_speed[1]);
+		printf_P(PSTR("Extr fan speed: %d\n"), fan_speed[0]);
 
 		if (fan_speed[0] < 20) { // < 1200 RPM would mean either a faulty Noctua or Altfan
 			return FanCheck::ExtruderFan;
@@ -8669,9 +8669,9 @@ static FanCheck lcd_selftest_fan_auto(int _fan)
 		manage_heater();			//turn off fan
 		manage_inactivity(true);	//to turn off print fan
 #endif //FAN_SOFT_PWM
-		printf_P(PSTR("Test 2:\n"));
-		printf_P(PSTR("Print fan speed: %d \n"), fan_speed[1]);
-		printf_P(PSTR("Extr fan speed: %d \n"), fan_speed[0]);
+		puts_P(PSTR("Test 2:"));
+		printf_P(PSTR("Print fan speed: %d\n"), fan_speed[1]);
+		printf_P(PSTR("Extr fan speed: %d\n"), fan_speed[0]);
 		if (!fan_speed[1]) {
 			return FanCheck::PrintFan;
 		}