|
@@ -155,15 +155,16 @@ float transientList [10][2]; //array to store Transient List data
|
|
|
int total_instructions; //used in Transient List Mode
|
|
|
int current_instruction; //used in Transient List Mode
|
|
|
|
|
|
+char line0[line_len]= {0};
|
|
|
char line1[line_len]= {0};
|
|
|
char line2[line_len]= {0};
|
|
|
char line3[line_len]= {0};
|
|
|
-char line4[line_len]= {0};
|
|
|
-char line1_buf[line_len]= {0};
|
|
|
-char line2_buf[line_len]= {0};
|
|
|
-char line3_buf[line_len]= {0};
|
|
|
-char line4_buf[line_len]= {0};
|
|
|
-
|
|
|
+char line0_old[line_len]= {0};
|
|
|
+char line1_old[line_len]= {0};
|
|
|
+char line2_old[line_len]= {0};
|
|
|
+char line3_old[line_len]= {0};
|
|
|
+char temperature_val[5]={0x00};
|
|
|
+char temperature_buf[5]={0x00};
|
|
|
bool old_load=true;
|
|
|
void setmode(void);
|
|
|
void color_load (bool load);
|
|
@@ -372,16 +373,16 @@ nDevices = 0;
|
|
|
|
|
|
screen_clear('\0');
|
|
|
writeNum2("t0.xcen", 1); //print SCULLCOM to display with 5 leading spaces (you can change to your own)
|
|
|
- memcpy(line1,(char*)"SCULLCOM",9);
|
|
|
+ memcpy(line0,(char*)"SCULLCOM",9);
|
|
|
print_chars2(0,9);
|
|
|
|
|
|
- memcpy(line2,(char*)"Hobby Electronics",18);
|
|
|
+ memcpy(line1,(char*)"Hobby Electronics",18);
|
|
|
print_chars2(1,18);
|
|
|
|
|
|
- memcpy(line3,(char*)"DC Electronic Load",19);
|
|
|
+ memcpy(line2,(char*)"DC Electronic Load",19);
|
|
|
print_chars2(2,19);
|
|
|
|
|
|
- memcpy(line4,(char*)"Ver. 35 (5x4 Keypad)",21);
|
|
|
+ memcpy(line3,(char*)"Ver. 35 (5x4 Keypad)",21);
|
|
|
print_chars2(3,21);
|
|
|
|
|
|
delay(2000); //3000 mSec delay for intro display
|
|
@@ -393,10 +394,7 @@ nDevices = 0;
|
|
|
last_time = 0; //set the last_time to 0 at the start (Transicent Mode)
|
|
|
transient_mode_status = false; //set the initial transient mode status (false = low, true = high);
|
|
|
setCurrent = LowCurrent; //first set the current to the low current value (Transicent Mode)
|
|
|
-
|
|
|
|
|
|
- line1[18]=0xB0;
|
|
|
- line1[19]='C';
|
|
|
color_load(0);
|
|
|
Current(); //sets initial mode to be CC (Constant Current) at Power Up
|
|
|
//EEPROM.write(0x00, 0xff);
|
|
@@ -435,6 +433,10 @@ void loop() {
|
|
|
lastCount = encoderPosition; //store rotary encoder current position
|
|
|
CursorPosition(); //check and change the cursor position if cursor button pressed
|
|
|
}else{
|
|
|
+ maxConstantCurrentSetting(); //set maxiumum Current allowed in Constant Current Mode (CC)
|
|
|
+ powerLevelCutOff(); //Check if Power Limit has been exceeded
|
|
|
+
|
|
|
+ temperatureCutOff(); //check if Maximum Temperature is exceeded
|
|
|
transientLoadToggle(); //Start Transient Mode
|
|
|
}
|
|
|
|
|
@@ -488,8 +490,6 @@ void readKeypadInput (void) {
|
|
|
|
|
|
if(customKey == 'A'){ //check if Constant Current button pressed
|
|
|
toggle = false; //switch Load OFF
|
|
|
- line1[18]=0xB0;
|
|
|
- line1[19]='C';
|
|
|
color_load(0);
|
|
|
print_chars2(0,20);
|
|
|
Current(); //if selected go to Constant Current Selected routine
|
|
@@ -502,8 +502,6 @@ void readKeypadInput (void) {
|
|
|
|
|
|
if(customKey == 'B'){ //check if Constant Power button pressed
|
|
|
toggle = false; //switch Load OFF
|
|
|
- line1[18]=0xB0;
|
|
|
- line1[19]='C';
|
|
|
color_load(0);
|
|
|
print_chars2(0,20);
|
|
|
Power(); //if selected go to Constant Power Selected routine
|
|
@@ -516,8 +514,6 @@ void readKeypadInput (void) {
|
|
|
|
|
|
if(customKey == '#'){ //check if Constant Resistance button pressed
|
|
|
toggle = false; //switch Load OFF
|
|
|
- line1[18]=0xB0;
|
|
|
- line1[19]='C';
|
|
|
color_load(0);
|
|
|
print_chars2(0,20);
|
|
|
Resistance(); //if selected go to Constant Resistance Selected routine
|
|
@@ -536,8 +532,6 @@ void readKeypadInput (void) {
|
|
|
z = 1; //sets column position for LCD displayed character
|
|
|
decimalPoint = (' '); //clear decimal point test character reset
|
|
|
if (exitMode == 1){ //if NO battery type selected revert to CC Mode
|
|
|
- line1[18]=0xB0;
|
|
|
- line1[19]='C';
|
|
|
color_load(0);
|
|
|
print_chars2(0,20);
|
|
|
Current(); //if selected go to Constant Current Selected routine
|
|
@@ -546,10 +540,8 @@ void readKeypadInput (void) {
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- memcpy(line3+16,(char*)BatteryType.c_str(),4);
|
|
|
+ memcpy(line2+16,(char*)BatteryType.c_str(),4);
|
|
|
print_chars2(2,20);
|
|
|
- line1[18]=0xB0;
|
|
|
- line1[19]='C';
|
|
|
color_load(0);
|
|
|
print_chars2(0,20);
|
|
|
timer.reset(); //reset timer
|
|
@@ -559,12 +551,12 @@ void readKeypadInput (void) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- if (Mode != MODE_BC){
|
|
|
+ if (Mode != MODE_TC && Mode != MODE_TL && Mode != MODE_TP && Mode != MODE_TT){
|
|
|
|
|
|
if(customKey >= '0' && customKey <= '9'){ //check for keypad number input
|
|
|
numbers[index++] = customKey;
|
|
|
numbers[index] = '\0';
|
|
|
- line4[z]=customKey;
|
|
|
+ line3[z]=customKey;
|
|
|
print_chars2(3,20);
|
|
|
z = z+1;
|
|
|
customKey ='\0';
|
|
@@ -574,7 +566,7 @@ void readKeypadInput (void) {
|
|
|
if (decimalPoint != ('>')){ //test if decimal point entered twice - if so skip
|
|
|
numbers[index++] = '.';
|
|
|
numbers[index] = '\0';
|
|
|
- line4[z]='.';
|
|
|
+ line3[z]='.';
|
|
|
print_chars2(3,20);
|
|
|
z = z+1;
|
|
|
decimalPoint = ('>'); //used to indicate decimal point has been input
|
|
@@ -638,8 +630,6 @@ void powerLevelCutOff (void) {
|
|
|
encoderPosition = 0;
|
|
|
|
|
|
print_chars(3,0,(char*)"Exceeded Power ",20);
|
|
|
- line1[18]=0xB0;
|
|
|
- line1[19]='C';
|
|
|
color_load(0);
|
|
|
print_chars2(0,20);
|
|
|
toggle = false; //switch Load Off
|
|
@@ -751,8 +741,8 @@ void ActualReading(void) {
|
|
|
} else {
|
|
|
dtostrf(ActualCurrent, 4, 2, buff);
|
|
|
}
|
|
|
- memcpy(line2,buff ,5);
|
|
|
- memcpy(line2+5,(char *)"A " ,2);
|
|
|
+ memcpy(line1,buff ,5);
|
|
|
+ memcpy(line1+5,(char *)"A " ,2);
|
|
|
|
|
|
if (ActualVoltage < 10.0) {
|
|
|
//lcd.print(ActualVoltage, 3);
|
|
@@ -760,15 +750,15 @@ void ActualReading(void) {
|
|
|
} else {
|
|
|
dtostrf(ActualVoltage, 4, 2, buff);
|
|
|
}
|
|
|
- memcpy(line2+7,buff ,6);
|
|
|
- memcpy(line2+12,(char *)"V " ,2);
|
|
|
+ memcpy(line1+7,buff ,6);
|
|
|
+ memcpy(line1+12,(char *)"V " ,2);
|
|
|
|
|
|
if (ActualPower < 100 ) {
|
|
|
dtostrf(ActualPower, 4, 2, buff);
|
|
|
} else {
|
|
|
dtostrf(ActualPower, 4, 1, buff);
|
|
|
}
|
|
|
- memcpy(line2+14,buff ,6);
|
|
|
+ memcpy(line1+14,buff ,6);
|
|
|
print_chars(1,18,(char *)"W " ,2);
|
|
|
}
|
|
|
|
|
@@ -807,16 +797,11 @@ if (Mode == MODE_TC || Mode == MODE_TP || Mode == MODE_TT || Mode == MODE_TL){
|
|
|
//-------------------------------------Battery Capacity Discharge Routine----------------------------------------------------
|
|
|
void batteryCapacityloop (void) {
|
|
|
if (Mode == MODE_BC){
|
|
|
- Serial.println("TEST");
|
|
|
setCurrent = reading*1000; //set current is equal to input value in Amps
|
|
|
setReading = setCurrent; //show the set current reading being used
|
|
|
setControlCurrent = setCurrent * setCurrentCalibrationFactor;
|
|
|
controlVoltage = setControlCurrent;
|
|
|
-
|
|
|
- //lcd.setCursor(0,3);
|
|
|
- //lcd.print (timer.getTime());
|
|
|
-
|
|
|
- print_chars(3,0,(char*)timer.getTime().c_str(),8);
|
|
|
+ memcpy(line3,(char*)timer.getTime().c_str(),8);
|
|
|
Seconds = timer.getTotalSeconds(); //get totals seconds
|
|
|
|
|
|
LoadCurrent = ActualCurrent; //if timer still running use present Actual Current reading
|
|
@@ -825,51 +810,50 @@ void batteryCapacityloop (void) {
|
|
|
}
|
|
|
|
|
|
BatteryLife = (LoadCurrent*1000)*(Seconds/3600); //calculate battery capacity in mAh
|
|
|
- //lcd.setCursor(9,3);
|
|
|
BatteryLife = round(BatteryLife);
|
|
|
|
|
|
if(BatteryLife >= BatteryLifePrevious){ //only update LCD (mAh) if BatteryLife has increased
|
|
|
|
|
|
if (BatteryLife < 10) { //add a 3 leading zero to display if reading less than 10
|
|
|
- //lcd.print("000");
|
|
|
- print_chars(3,9,(char*)String(BatteryLife).c_str(),3);
|
|
|
- }
|
|
|
|
|
|
- if (BatteryLife >= 10 && BatteryLife <100){ //add a 2 leading zero to display
|
|
|
- print_chars(3,9,(char*)String(BatteryLife).c_str(),2);
|
|
|
+ memcpy(line3+9,"000",3);
|
|
|
+ memcpy(line3+12,(char*)String(BatteryLife).c_str(),1);
|
|
|
}
|
|
|
-
|
|
|
- if (BatteryLife >= 100 && BatteryLife <1000){ //add a 1 leading zero to display
|
|
|
- print_chars(3,9,(char*)"0",1);
|
|
|
+ else if (BatteryLife >= 10 && BatteryLife <100){ //add a 2 leading zero to display
|
|
|
+ memcpy(line3+9,"00",2);
|
|
|
+ memcpy(line3+11,(char*)String(BatteryLife).c_str(),2);
|
|
|
}
|
|
|
-
|
|
|
- //lcd.print(BatteryLife,0);
|
|
|
- print_chars(3,13,"mAh",3);
|
|
|
+ else if (BatteryLife >= 100 && BatteryLife <1000){ //add a 1 leading zero to display
|
|
|
+ memcpy(line3+9,"0",1);
|
|
|
+ memcpy(line3+10,(char*)String(BatteryLife).c_str(),3);
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ memcpy(line3+9,(char*)String(BatteryLife).c_str(),4);
|
|
|
+ }
|
|
|
+
|
|
|
+ memcpy(line3+13,"mAh",3);
|
|
|
+ print_chars2(3,20);
|
|
|
BatteryLifePrevious = BatteryLife; //update displayed battery capacity on LCD
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
if (Mode == MODE_BC && ActualVoltage <= BatteryCutoffVolts){ //stops clock if battery reached cutoff level and switch load off
|
|
|
-
|
|
|
- BatteryCurrent = ActualCurrent;
|
|
|
- setVoltage(0,false); //reset DAC to zero for no output current set at switch on
|
|
|
- toggle = false; //Load is toggled OFF
|
|
|
- line1[18]=0xB0;
|
|
|
- line1[19]='C';
|
|
|
- color_load(0);
|
|
|
- print_chars2(0,20);
|
|
|
- timer.stop();
|
|
|
+ BatteryCurrent = ActualCurrent;
|
|
|
+ setVoltage(0,false); //reset DAC to zero for no output current set at switch on
|
|
|
+ toggle = false; //Load is toggled OFF
|
|
|
+ color_load(0);
|
|
|
+ timer.stop();
|
|
|
}
|
|
|
|
|
|
- if (Mode == MODE_BC && Load == 1){ //Routine used for data logging in Battery Capacity Mode
|
|
|
- if (Seconds != SecondsLog){ //only send serial data if time has changed
|
|
|
- SecondsLog = Seconds;
|
|
|
- Serial.print (SecondsLog); //sends serial data of time in seconds
|
|
|
- Serial.print (","); //sends a comma as delimiter for logged data
|
|
|
- Serial.println (ActualVoltage); //sends serial data of Voltage reading
|
|
|
- }
|
|
|
- }
|
|
|
+ if (Mode == MODE_BC && Load == 1){ //Routine used for data logging in Battery Capacity Mode
|
|
|
+ if (Seconds != SecondsLog){ //only send serial data if time has changed
|
|
|
+ SecondsLog = Seconds;
|
|
|
+ Serial.print (SecondsLog); //sends serial data of time in seconds
|
|
|
+ Serial.print (","); //sends a comma as delimiter for logged data
|
|
|
+ Serial.println (ActualVoltage); //sends serial data of Voltage reading
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
}
|
|
|
|
|
@@ -884,10 +868,11 @@ void fanControl (void) {
|
|
|
digitalWrite(fan, LOW); //otherwise turn fan turned off
|
|
|
}
|
|
|
|
|
|
- memcpy(line1+16,(char*)String(temp).c_str(),2);
|
|
|
- line1[18]=0xB0;
|
|
|
- line1[19]='C';
|
|
|
- print_chars2(0,21);
|
|
|
+ memcpy(temperature_val,(char*)String(temp).c_str(),2);
|
|
|
+ temperature_val[2]=0xB0;
|
|
|
+ temperature_val[3]='C';
|
|
|
+ temperature_val[4]=0x00;
|
|
|
+ print_temp();
|
|
|
|
|
|
}
|
|
|
|
|
@@ -899,10 +884,7 @@ void LoadSwitch(void) {
|
|
|
|
|
|
if(toggle)
|
|
|
{
|
|
|
- line1[18]=0xB0;
|
|
|
- line1[19]='C';
|
|
|
color_load(0);
|
|
|
- print_chars2(0,20);
|
|
|
|
|
|
color_load(0);
|
|
|
current_instruction = 0; //reset current instruction for Transient List Mode to zero
|
|
@@ -914,9 +896,6 @@ void LoadSwitch(void) {
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- line1[18]=0xB0;
|
|
|
- line1[19]='C';
|
|
|
- print_chars2(0,20);
|
|
|
print_chars(3,0,(char*)" ",20);
|
|
|
color_load(1);
|
|
|
toggle = !toggle;
|
|
@@ -927,11 +906,11 @@ void LoadSwitch(void) {
|
|
|
//-----------------------Select Constant Current LCD set up--------------------------------
|
|
|
void Current(void) {
|
|
|
Mode = MODE_CC;
|
|
|
- memcpy(line1,(char*)"DC LOAD ",8);
|
|
|
+ memcpy(line0,(char*)"DC LOAD ",8);
|
|
|
print_chars2(0,20);
|
|
|
writeNum2("t0.xcen",(uint16_t) 0);
|
|
|
print_chars(2,0,(char*)"Set I = A",20);
|
|
|
- memset(line4,' ',20);
|
|
|
+ memset(line3,' ',20);
|
|
|
print_chars2(3,20);
|
|
|
CP = 9; //sets cursor starting position to units.
|
|
|
setmode() ;
|
|
@@ -941,10 +920,10 @@ void Current(void) {
|
|
|
void Power(void) {
|
|
|
Mode = MODE_CP;
|
|
|
writeNum2("t0.xcen",(int) 0);
|
|
|
- memcpy(line1,(char*)"DC LOAD ",7);
|
|
|
+ memcpy(line0,(char*)"DC LOAD ",7);
|
|
|
print_chars2(0,20);
|
|
|
print_chars(2,0,(char*)"Set W = W",22);
|
|
|
- memset(line4,' ',20);
|
|
|
+ memset(line3,' ',20);
|
|
|
print_chars2(3,20);
|
|
|
CP = 10; //sets cursor starting position to units.
|
|
|
setmode() ;
|
|
@@ -954,10 +933,10 @@ void Power(void) {
|
|
|
void Resistance(void) {
|
|
|
Mode = MODE_CR;
|
|
|
writeNum2("t0.xcen",(int) 0);
|
|
|
- memcpy(line1,(char*)"DC LOAD ",8);
|
|
|
+ memcpy(line0,(char*)"DC LOAD ",8);
|
|
|
print_chars2(0,20);
|
|
|
print_chars(2,0,(char*)"Set R = R",20);
|
|
|
- memset(line4,' ',20);
|
|
|
+ memset(line3,' ',20);
|
|
|
print_chars2(3,20);
|
|
|
CP = 10; //sets cursor starting position to units.
|
|
|
setmode() ;
|
|
@@ -971,7 +950,7 @@ void BatteryCapacity(void) {
|
|
|
writeNum2("t0.xcen",0);
|
|
|
print_chars(0,0,(char*)"BATTERY ",20);
|
|
|
print_chars(2,0,(char*)"Set I = A",20);
|
|
|
- memset(line4,' ',20);
|
|
|
+ memset(line3,' ',20);
|
|
|
print_chars2(3,20);
|
|
|
CP = 9; //sets cursor starting position to units.
|
|
|
setmode() ;
|
|
@@ -1054,17 +1033,17 @@ void batteryTypeSelected (void) {
|
|
|
char buff[6];
|
|
|
if (exitMode != 1){ //if battery selection was EXIT then skip this routine
|
|
|
screen_clear(' ');
|
|
|
- memcpy(line1+2,"Battery Selected",16);
|
|
|
- memcpy(line2+8,(char *)BatteryType.c_str(),4);
|
|
|
- memcpy(line3+2,"Discharge Cutoff",16);
|
|
|
+ memcpy(line0+2,"Battery Selected",16);
|
|
|
+ memcpy(line1+8,(char *)BatteryType.c_str(),4);
|
|
|
+ memcpy(line2+2,"Discharge Cutoff",16);
|
|
|
dtostrf(BatteryCutoffVolts, 4, 2, buff);
|
|
|
- memcpy(line4+6,buff,4);
|
|
|
- memcpy(line4+11," volts",6);
|
|
|
+ memcpy(line3+6,buff,4);
|
|
|
+ memcpy(line3+11," volts",6);
|
|
|
print_chars2(0,21);
|
|
|
print_chars2(1,21);
|
|
|
print_chars2(2,21);
|
|
|
print_chars2(3,21);
|
|
|
- delay(3000);
|
|
|
+ delay(2000);
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -1146,8 +1125,8 @@ void transientMode (void) {
|
|
|
z = 11;
|
|
|
screen_clear(' ');
|
|
|
print_chars(0,4,(char*)"Transient Mode",15);
|
|
|
- memcpy(line2,(char *)"Set Low I=",11);
|
|
|
- memcpy(line2+19,(char *)"A " ,2);
|
|
|
+ memcpy(line1,(char *)"Set Low I=",11);
|
|
|
+ memcpy(line1+19,(char *)"A " ,2);
|
|
|
print_chars2(1,0);
|
|
|
inputValue(1);
|
|
|
|
|
@@ -1164,8 +1143,8 @@ void transientMode (void) {
|
|
|
customKey = 0x00;
|
|
|
|
|
|
z = 11;
|
|
|
- memcpy(line3,(char *)"Set High I=",11);
|
|
|
- memcpy(line3+19,(char *)"A " ,2);
|
|
|
+ memcpy(line2,(char *)"Set High I=",11);
|
|
|
+ memcpy(line2+19,(char *)"A " ,2);
|
|
|
print_chars2(2,0);
|
|
|
inputValue(2);
|
|
|
if(x >= CurrentCutOff){
|
|
@@ -1181,8 +1160,8 @@ void transientMode (void) {
|
|
|
|
|
|
if(Mode == MODE_TC || Mode == MODE_TP){
|
|
|
z = 11;
|
|
|
- memcpy(line4,(char *)"Set Time =",11);
|
|
|
- memcpy(line4+16,(char *)"mSec " ,5);
|
|
|
+ memcpy(line3,(char *)"Set Time =",11);
|
|
|
+ memcpy(line3+16,(char *)"mSec " ,5);
|
|
|
print_chars2(3,0);
|
|
|
inputValue(3);
|
|
|
transientPeriod = x;
|
|
@@ -1192,27 +1171,20 @@ void transientMode (void) {
|
|
|
|
|
|
}else{
|
|
|
|
|
|
- memset(line4,' ',20);
|
|
|
+ memset(line3,' ',20);
|
|
|
print_chars2(3,0);
|
|
|
}
|
|
|
|
|
|
screen_clear(' ');
|
|
|
|
|
|
toggle = false; //switch Load OFF
|
|
|
- memset(line1,' ',18);
|
|
|
- line1[18]=0xB0;
|
|
|
- line1[19]='C';
|
|
|
+ memset(line0,' ',18);
|
|
|
color_load(0);
|
|
|
- print_chars2(0,20);
|
|
|
}else{
|
|
|
transientListSetup();
|
|
|
screen_clear(' ');
|
|
|
toggle = false; //switch Load OFF
|
|
|
-
|
|
|
- line1[18]=0xB0;
|
|
|
- line1[19]='C';
|
|
|
color_load(0);
|
|
|
- print_chars2(0,20);
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -1222,15 +1194,15 @@ void transientType (void) {
|
|
|
exitMode = 0; //reset EXIT mode
|
|
|
screen_clear(' ');
|
|
|
writeNum2("t0.xcen",(int) 0); //print SCULLCOM to display with 5 leading spaces (you can change to your own)
|
|
|
- memcpy(line1,(char*)"Transient Mode",15);
|
|
|
+ memcpy(line0,(char*)"Transient Mode",15);
|
|
|
print_chars2(0,0);
|
|
|
- memcpy(line2,(char*)"1 = Continuous",15);
|
|
|
+ memcpy(line1,(char*)"1 = Continuous",15);
|
|
|
print_chars2(1,0);
|
|
|
- memcpy(line3,(char*)"2 = Toggle",10);
|
|
|
- memcpy(line3+11,(char*)"3 = Pulse",9);
|
|
|
+ memcpy(line2,(char*)"2 = Toggle",10);
|
|
|
+ memcpy(line2+11,(char*)"3 = Pulse",9);
|
|
|
print_chars2(2,0);
|
|
|
- memcpy(line4,(char*)"4 = List",8);
|
|
|
- memcpy(line4+11,(char*)"5 = Exit",9);
|
|
|
+ memcpy(line3,(char*)"4 = List",8);
|
|
|
+ memcpy(line3+11,(char*)"5 = Exit",9);
|
|
|
print_chars2(3,0);
|
|
|
|
|
|
wait_for_key(1); //stop everything till the user press a key.
|
|
@@ -1261,11 +1233,7 @@ void transientType (void) {
|
|
|
screen_clear(' ');
|
|
|
customKey=0x00;
|
|
|
if (exitMode == 1){ //if NO Transient Mode type selected revert to CC Mode
|
|
|
- line1[18]=0xB0;
|
|
|
- line1[19]='C';
|
|
|
-
|
|
|
color_load(0);
|
|
|
- print_chars2(0,20);
|
|
|
Current(); //if selected go to Constant Current Selected routine
|
|
|
encoderPosition = 0; //reset encoder reading to zero
|
|
|
customKey = 'A';
|
|
@@ -1278,28 +1246,31 @@ if (exitMode == 1){ //if NO Transient Mode
|
|
|
void transient (void) {
|
|
|
char buff[6]={0x00};
|
|
|
if(Mode == MODE_TC || Mode == MODE_TP || Mode == MODE_TT || Mode == MODE_TL){
|
|
|
- memcpy(line1,(char*)"DC LOAD ",8);
|
|
|
+ memcpy(line0,(char*)"DC LOAD ",8);
|
|
|
print_chars2(0,20);
|
|
|
if(Mode != MODE_TL){
|
|
|
- memcpy(line3,"Lo= A Hi= A",20);
|
|
|
+ memcpy(line2,"Lo= A Hi= A",20);
|
|
|
dtostrf(LowCurrent, 4, 3, buff);
|
|
|
- memcpy(line3+3,buff ,5);
|
|
|
+ memcpy(line2+3,buff ,5);
|
|
|
dtostrf(HighCurrent, 4, 3, buff);
|
|
|
- memcpy(line3+14,buff ,5);
|
|
|
- print_chars2(2,20);
|
|
|
+ memcpy(line2+14,buff ,5);
|
|
|
+
|
|
|
}else{
|
|
|
- delay(1);
|
|
|
+ memcpy(line2,"Set I = A",20);
|
|
|
+ dtostrf(transientList[current_instruction][0], 4, 3, buff);
|
|
|
+ memcpy(line2+8,buff ,5);
|
|
|
}
|
|
|
|
|
|
|
|
|
if(Mode == MODE_TC || Mode == MODE_TP || Mode == MODE_TL){
|
|
|
- memcpy(line4,"Time = mSecs ",20);
|
|
|
+ memcpy(line3,"Time = mSecs ",20);
|
|
|
dtostrf(transientPeriod, 5, 0, buff);
|
|
|
- memcpy(line4+7,buff,5);
|
|
|
+ memcpy(line3+7,buff,5);
|
|
|
}else{
|
|
|
- memcpy(line4," ",2);
|
|
|
+ memcpy(line3," ",2);
|
|
|
|
|
|
}
|
|
|
+ print_chars2(2,20);
|
|
|
print_chars2(3,20);
|
|
|
}
|
|
|
delay(1);
|
|
@@ -1310,11 +1281,11 @@ void transientListSetup(){
|
|
|
|
|
|
screen_clear(' ');
|
|
|
writeNum2("t0.xcen",(int) 0); //print SCULLCOM to display with 5 leading spaces (you can change to your own)
|
|
|
- memcpy(line1,(char*)"Setup Transient List",21);
|
|
|
+ memcpy(line0,(char*)"Setup Transient List",21);
|
|
|
print_chars2(0,0);
|
|
|
- memcpy(line2,(char*)"Enter Number in List",21);
|
|
|
+ memcpy(line1,(char*)"Enter Number in List",21);
|
|
|
print_chars2(1,0);
|
|
|
- memcpy(line3,(char*)"(between 2 to 10 max",21);
|
|
|
+ memcpy(line2,(char*)"(between 2 to 10 max",21);
|
|
|
print_chars2(2,0);
|
|
|
y = 0;
|
|
|
z = 0;
|
|
@@ -1325,11 +1296,11 @@ void transientListSetup(){
|
|
|
char buff[5] = {0x00};
|
|
|
for(int i=0; i<=(total_instructions); i++){
|
|
|
screen_clear(' ');
|
|
|
- memcpy(line1,"Set Current ",16);
|
|
|
+ memcpy(line0,"Set Current ",16);
|
|
|
int length = snprintf( NULL, 0, "%d", i+1 );
|
|
|
itoa(i+1 ,buff,10);
|
|
|
- memcpy(line1+12,buff,length);
|
|
|
- memcpy(line2," A",16);
|
|
|
+ memcpy(line0+12,buff,length);
|
|
|
+ memcpy(line1," A",16);
|
|
|
print_chars2(0,0);
|
|
|
print_chars2(1,0);
|
|
|
|
|
@@ -1338,12 +1309,12 @@ void transientListSetup(){
|
|
|
inputValue(1); //get the users input value
|
|
|
transientList[i][0] = x; //store the users entered value in the transient list
|
|
|
customKey = 0x00;
|
|
|
- memcpy(line3,"Set Time ",16);
|
|
|
+ memcpy(line2,"Set Time ",16);
|
|
|
length = snprintf( NULL, 0, "%d", i+1 );
|
|
|
itoa(i+1 ,buff,10);
|
|
|
|
|
|
- memcpy(line3+12,buff,length);
|
|
|
- memcpy(line4," mSec",19);
|
|
|
+ memcpy(line2+12,buff,length);
|
|
|
+ memcpy(line3," mSec",19);
|
|
|
print_chars2(2,0);
|
|
|
print_chars2(3,0);
|
|
|
y = 0;
|
|
@@ -1458,13 +1429,13 @@ void userSetUp (void) {
|
|
|
writeNum2("t2.xcen",(int) 0);
|
|
|
writeNum2("t3.xcen",(int) 0);
|
|
|
|
|
|
- memcpy(line1,"User Set-Up ",21);
|
|
|
+ memcpy(line0,"User Set-Up ",21);
|
|
|
print_chars2(0,20);
|
|
|
- memset(line3,' ',20);
|
|
|
+ memset(line2,' ',20);
|
|
|
print_chars2(2,20);
|
|
|
- memset(line4,' ',20);
|
|
|
+ memset(line3,' ',20);
|
|
|
print_chars2(3,20);
|
|
|
- memcpy(line2,"Current Limit= A",21);
|
|
|
+ memcpy(line1,"Current Limit= A",21);
|
|
|
print_chars2(1,20);
|
|
|
|
|
|
inputValue(1);
|
|
@@ -1473,7 +1444,7 @@ void userSetUp (void) {
|
|
|
|
|
|
customKey = 0x00;
|
|
|
z = 15;
|
|
|
- memcpy(line3,"Power Limit = W",21);
|
|
|
+ memcpy(line2,"Power Limit = W",21);
|
|
|
print_chars2(2,20);
|
|
|
inputValue(2);
|
|
|
PowerCutOff = x;
|
|
@@ -1481,8 +1452,8 @@ void userSetUp (void) {
|
|
|
|
|
|
customKey = 0x00;
|
|
|
z = 15;
|
|
|
- line4[18]=0xB0;
|
|
|
- memcpy(line4,"Temp. Limit = C",21);
|
|
|
+ line3[18]=0xB0;
|
|
|
+ memcpy(line3,"Temp. Limit = C",21);
|
|
|
print_chars2(3,20);
|
|
|
inputValue(3);
|
|
|
z = 1;
|
|
@@ -1492,10 +1463,7 @@ void userSetUp (void) {
|
|
|
|
|
|
writeNum2("t0.xcen",(int) 0);
|
|
|
screen_clear(' ');
|
|
|
- line1[18]=0xB0;
|
|
|
- line1[19]='C';
|
|
|
color_load(0);
|
|
|
- print_chars2(0,20);
|
|
|
Current(); //if selected go to Constant Current Selected routine
|
|
|
encoderPosition = 0; //reset encoder reading to zero
|
|
|
customKey = 'A';
|
|
@@ -1506,11 +1474,8 @@ void temperatureCutOff (void){
|
|
|
if (temp >= tempCutOff){ //if Maximum temperature is exceeded
|
|
|
reading = 0;
|
|
|
encoderPosition = 0;
|
|
|
- memcpy(line4,"Over Temperature ",20);
|
|
|
+ memcpy(line3,"Over Temperature ",20);
|
|
|
print_chars2(3,20);
|
|
|
- line1[18]=0xB0;
|
|
|
- line1[19]='C';
|
|
|
- print_chars2(0,20);
|
|
|
color_load(0);
|
|
|
toggle = false; //switch Load Off
|
|
|
}
|
|
@@ -1553,29 +1518,29 @@ void setupLimits (void){
|
|
|
writeNum2("t1.xcen",(int) 0);
|
|
|
writeNum2("t2.xcen",(int) 0);
|
|
|
writeNum2("t3.xcen",(int) 0);
|
|
|
- memcpy(line1," Maximum Limits Set ",20);
|
|
|
+ memcpy(line0," Maximum Limits Set ",20);
|
|
|
print_chars2(0,20);
|
|
|
char snum[5];
|
|
|
- memcpy(line2,"Current Limit= A ",20);
|
|
|
+ memcpy(line1,"Current Limit= A ",20);
|
|
|
CurrentCutOff = EEPROM.read(0x00);
|
|
|
int length = snprintf( NULL, 0, "%d", CurrentCutOff );
|
|
|
|
|
|
itoa(CurrentCutOff, snum, 10);
|
|
|
- memcpy(line2+15,snum,length);
|
|
|
+ memcpy(line1+15,snum,length);
|
|
|
print_chars2(1,20);
|
|
|
|
|
|
- memcpy(line3,"Power Limit = W ",20);
|
|
|
+ memcpy(line2,"Power Limit = W ",20);
|
|
|
PowerCutOff = EEPROM.read(0x20);
|
|
|
length = snprintf( NULL, 0, "%d", PowerCutOff );
|
|
|
itoa(PowerCutOff, snum, 10);
|
|
|
- memcpy(line3+15,snum,length);
|
|
|
+ memcpy(line2+15,snum,length);
|
|
|
print_chars2(2,20);
|
|
|
|
|
|
- memcpy(line4,"Temp. Limit = C ",20);
|
|
|
+ memcpy(line3,"Temp. Limit = C ",20);
|
|
|
tempCutOff = EEPROM.read(0x40);
|
|
|
length = snprintf( NULL, 0, "%d", tempCutOff );
|
|
|
itoa(tempCutOff, snum, 10);
|
|
|
- memcpy(line4+15,snum,length);
|
|
|
+ memcpy(line3+15,snum,length);
|
|
|
print_chars2(3,20);
|
|
|
|
|
|
|