Browse Source

Fix Dcodes compilation errors and warnings.

Marek Bel 5 years ago
parent
commit
4100bd33a7
3 changed files with 14 additions and 14 deletions
  1. 12 12
      Firmware/Dcodes.cpp
  2. 1 1
      Firmware/Marlin_main.cpp
  3. 1 1
      Firmware/temperature.h

+ 12 - 12
Firmware/Dcodes.cpp

@@ -5,6 +5,9 @@
 #include <stdio.h>
 #include <avr/pgmspace.h>
 
+#define SHOW_TEMP_ADC_VALUES
+#include "temperature.h"
+
 
 #define DBG(args...) printf_P(args)
 
@@ -150,7 +153,7 @@ void dcode_3()
 #include <avr/wdt.h>
 #include "bootapp.h"
 
-/*
+#if 0
 #define FLASHSIZE     0x40000
 
 #define RAMSIZE        0x2000
@@ -169,9 +172,10 @@ extern float current_temperature_pinda;
 extern float axis_steps_per_unit[NUM_AXIS];
 
 
-//#define LOG(args...) printf(args)
+#define LOG(args...) printf(args)
+#endif //0
 #define LOG(args...)
-*/
+
 #ifdef DEBUG_DCODES
 
 void dcode__1()
@@ -227,7 +231,7 @@ void dcode_2()
 		count = parse_hex(strchr_pointer + 1, data, 16);
 		if (count > 0)
 		{
-			for (int i = 0; i < count; i++)
+			for (uint16_t i = 0; i < count; i++)
 				*((uint8_t*)(address + i)) =  data[i];
 			LOG("%d bytes written to RAM at address %04x", count, address);
 		}
@@ -380,7 +384,7 @@ void dcode_8()
 		{
 			uint16_t offs = 0;
 			if (i > 0) offs = eeprom_read_word(((uint16_t*)EEPROM_PROBE_TEMP_SHIFT) + (i - 1));
-			float foffs = ((float)offs) / axis_steps_per_unit[Z_AXIS];
+			float foffs = ((float)offs) / cs.axis_steps_per_unit[Z_AXIS];
 			offs = 1000 * foffs;
 			printf_P(PSTR("temp_pinda=%dC temp_shift=%dum\n"), 35 + i * 5, offs);
 		}
@@ -423,10 +427,6 @@ const char* dcode_9_ADC_name(uint8_t i)
 	return 0;
 }
 
-extern int current_temperature_raw[EXTRUDERS];
-extern int current_temperature_bed_raw;
-extern int current_temperature_raw_pinda;
-
 #ifdef AMBIENT_THERMISTOR
 extern int current_temperature_raw_ambient;
 #endif //AMBIENT_THERMISTOR
@@ -606,16 +606,16 @@ void dcode_2130()
 			else if (strncmp(strchr_pointer + 7, "mres", 4) == 0)
 			{
 				uint8_t mres = strchr_pointer[11] - '0';
-				if ((mres >= 0) && (mres <= 8))
+				if (mres <= 8)
 				{
 					st_synchronize();
 					uint16_t res = tmc2130_get_res(axis);
 					uint16_t res_new = tmc2130_mres2usteps(mres);
 					tmc2130_set_res(axis, res_new);
 					if (res_new > res)
-						axis_steps_per_unit[axis] *= (res_new / res);
+						cs.axis_steps_per_unit[axis] *= (res_new / res);
 					else
-						axis_steps_per_unit[axis] /= (res / res_new);
+						cs.axis_steps_per_unit[axis] /= (res / res_new);
 				}
 			}
 			else if (strncmp(strchr_pointer + 7, "wave", 4) == 0)

+ 1 - 1
Firmware/Marlin_main.cpp

@@ -7251,7 +7251,7 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE))
 		dcode_2130(); break;
 #endif //TMC2130
 
-#ifdef FILAMENT_SENSOR
+#if (defined (FILAMENT_SENSOR) && defined(PAT9125))
 	case 9125: //! D9125 - FILAMENT_SENSOR
 		dcode_9125(); break;
 #endif //FILAMENT_SENSOR

+ 1 - 1
Firmware/temperature.h

@@ -57,7 +57,7 @@ extern int target_temperature_bed;
 extern float current_temperature_bed;
 
 #ifdef PINDA_THERMISTOR
-//extern int current_temperature_raw_pinda;
+extern uint16_t current_temperature_raw_pinda;
 extern float current_temperature_pinda;
 #endif