Browse Source

Mark unchanging arrays as const (PR#2494)

The compiler may be able to optimize if it knows an array won’t be
changing.
pull/1/head
Scott Lahteine 10 years ago
committed by Richard Wackerbarth
parent
commit
c66955aaf9
  1. 1
      Marlin/Marlin.h
  2. 6
      Marlin/Marlin_main.cpp
  3. 2
      Marlin/ultralcd.cpp

1
Marlin/Marlin.h

@ -241,7 +241,6 @@ inline void refresh_cmd_timeout() { previous_cmd_ms = millis(); }
#define CRITICAL_SECTION_END SREG = _sreg;
#endif
extern float homing_feedrate[];
extern bool axis_relative_modes[];
extern int feedrate_multiplier;
extern bool volumetric_enabled;

6
Marlin/Marlin_main.cpp

@ -246,7 +246,7 @@ static int cmd_queue_index_w = 0;
static int commands_in_queue = 0;
static char command_queue[BUFSIZE][MAX_CMD_SIZE];
float homing_feedrate[] = HOMING_FEEDRATE;
const float homing_feedrate[] = HOMING_FEEDRATE;
bool axis_relative_modes[] = AXIS_RELATIVE_MODES;
int feedrate_multiplier = 100; //100->1 200->2
int saved_feedrate_multiplier;
@ -310,8 +310,8 @@ bool target_direction;
#endif
#ifdef SERVO_ENDSTOPS
int servo_endstops[] = SERVO_ENDSTOPS;
int servo_endstop_angles[] = SERVO_ENDSTOP_ANGLES;
const int servo_endstops[] = SERVO_ENDSTOPS;
const int servo_endstop_angles[] = SERVO_ENDSTOP_ANGLES;
#endif
#ifdef BARICUDA

2
Marlin/ultralcd.cpp

@ -44,7 +44,7 @@ static void lcd_status_screen();
#if HAS_POWER_SWITCH
extern bool powersupply;
#endif
static float manual_feedrate[] = MANUAL_FEEDRATE;
const float manual_feedrate[] = MANUAL_FEEDRATE;
static void lcd_main_menu();
static void lcd_tune_menu();
static void lcd_prepare_menu();

Loading…
Cancel
Save