made many possible variables static, so they cannot be used extern.

This commit is contained in:
Bernhard Kubicek 2011-11-06 19:36:29 +01:00
parent 1d171e9e52
commit 79d1bfb5c0
3 changed files with 39 additions and 31 deletions

View file

@ -65,6 +65,7 @@
#include "temperature.h"
#include "ultralcd.h"
//public variables
unsigned long minsegmenttime;
float max_feedrate[4]; // set the max speeds
float axis_steps_per_unit[4];
@ -76,14 +77,16 @@ float max_xy_jerk; //speed than can be stopped at once, if i understand correctl
float max_z_jerk;
float mintravelfeedrate;
unsigned long axis_steps_per_sqr_second[NUM_AXIS];
// Manage heater variables.
long position[4]; //rescaled from extern when axis_steps_per_unit are changed by gcode
//private variables
static block_t block_buffer[BLOCK_BUFFER_SIZE]; // A ring buffer for motion instfructions
static volatile unsigned char block_buffer_head; // Index of the next block to be pushed
static volatile unsigned char block_buffer_tail; // Index of the block to process now
// The current position of the tool in absolute steps
long position[4];
#define ONE_MINUTE_OF_MICROSECONDS 60000000.0

View file

@ -42,25 +42,29 @@
int target_raw[3] = {0, 0, 0};
int current_raw[3] = {0, 0, 0};
bool temp_meas_ready = false;
static bool temp_meas_ready = false;
unsigned long previous_millis_heater, previous_millis_bed_heater;
static unsigned long previous_millis_heater, previous_millis_bed_heater;
#ifdef PIDTEMP
float temp_iState = 0;
float temp_dState = 0;
float pTerm;
float iTerm;
float dTerm;
//static cannot be external:
static float temp_iState = 0;
static float temp_dState = 0;
static float pTerm;
static float iTerm;
static float dTerm;
//int output;
float pid_error;
float temp_iState_min;
float temp_iState_max;
float pid_setpoint = 0.0;
float pid_input;
float pid_output;
bool pid_reset;
static float pid_error;
static float temp_iState_min;
static float temp_iState_max;
static float pid_input;
static float pid_output;
static bool pid_reset;
// probably used external
float HeaterPower;
float pid_setpoint = 0.0;
float Kp=DEFAULT_Kp;
float Ki=DEFAULT_Ki;
@ -69,29 +73,29 @@ unsigned long previous_millis_heater, previous_millis_bed_heater;
#endif //PIDTEMP
#ifdef WATCHPERIOD
int watch_raw[3] = {-1000,-1000,-1000};
unsigned long watchmillis = 0;
static int watch_raw[3] = {-1000,-1000,-1000};
static unsigned long watchmillis = 0;
#endif //WATCHPERIOD
#ifdef HEATER_0_MINTEMP
int minttemp_0 = temp2analog(HEATER_0_MINTEMP);
static int minttemp_0 = temp2analog(HEATER_0_MINTEMP);
#endif //MINTEMP
#ifdef HEATER_0_MAXTEMP
int maxttemp_0 = temp2analog(HEATER_0_MAXTEMP);
static int maxttemp_0 = temp2analog(HEATER_0_MAXTEMP);
#endif //MAXTEMP
#ifdef HEATER_1_MINTEMP
int minttemp_1 = temp2analog(HEATER_1_MINTEMP);
static int minttemp_1 = temp2analog(HEATER_1_MINTEMP);
#endif //MINTEMP
#ifdef HEATER_1_MAXTEMP
int maxttemp_1 = temp2analog(HEATER_1_MAXTEMP);
static int maxttemp_1 = temp2analog(HEATER_1_MAXTEMP);
#endif //MAXTEMP
#ifdef BED_MINTEMP
int bed_minttemp = temp2analog(BED_MINTEMP);
static int bed_minttemp = temp2analog(BED_MINTEMP);
#endif //BED_MINTEMP
#ifdef BED_MAXTEMP
int bed_maxttemp = temp2analog(BED_MAXTEMP);
static int bed_maxttemp = temp2analog(BED_MAXTEMP);
#endif //BED_MAXTEMP
void manage_heater()

View file

@ -3,14 +3,17 @@
extern volatile int feedmultiply;
extern volatile bool feedmultiplychanged;
extern long position[4];
char messagetext[LCD_WIDTH]="";
static char messagetext[LCD_WIDTH]="";
#include <LiquidCrystal.h>
LiquidCrystal lcd(LCD_PINS_RS, LCD_PINS_ENABLE, LCD_PINS_D4, LCD_PINS_D5,LCD_PINS_D6,LCD_PINS_D7); //RS,Enable,D4,D5,D6,D7
unsigned long previous_millis_lcd=0;
static unsigned long previous_millis_lcd=0;
static long previous_millis_buttons=0;
inline int intround(const float &x){return int(0.5+x);}
@ -18,9 +21,9 @@ volatile char buttons=0; //the last checked buttons in a bit array.
int encoderpos=0;
short lastenc=0;
#ifdef NEWPANEL
long blocking=0;
static long blocking=0;
#else
long blocking[8]={0,0,0,0,0,0,0,0};
static long blocking[8]={0,0,0,0,0,0,0,0};
#endif
MainMenu menu;
@ -31,10 +34,9 @@ void lcd_status(const char* message)
inline void clear()
{
lcd.clear();
}
long previous_millis_buttons=0;
void lcd_init()
{
@ -228,7 +230,6 @@ MainMenu::MainMenu()
linechanging=false;
}
extern volatile bool feedmultiplychanged;
void MainMenu::showStatus()
{