|
@@ -14,11 +14,6 @@
|
|
#include <config.h>
|
|
#include <config.h>
|
|
#include <input.h>
|
|
#include <input.h>
|
|
#include <screen.h>
|
|
#include <screen.h>
|
|
-#include <SoftwareSerial.h>
|
|
|
|
-
|
|
|
|
-SoftwareSerial nexSerial (rxPin,txPin);
|
|
|
|
-
|
|
|
|
-
|
|
|
|
|
|
|
|
void setupLimits (void);
|
|
void setupLimits (void);
|
|
void transientSwitch(float current_setting, boolean toggle_status);
|
|
void transientSwitch(float current_setting, boolean toggle_status);
|
|
@@ -55,35 +50,23 @@ void wait_for_key(bool wait =true );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-uint8_t customKey;
|
|
|
|
-
|
|
|
|
-bool decimalPoint=false; //used to test for more than one press of * key (decimal point)
|
|
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
MCP342x adc = MCP342x(I2C_MCP342x_ADDRESS);
|
|
MCP342x adc = MCP342x(I2C_MCP342x_ADDRESS);
|
|
-
|
|
|
|
MCP79410_Timer timer = MCP79410_Timer(I2C_MCP79410_ADDRESS);
|
|
MCP79410_Timer timer = MCP79410_Timer(I2C_MCP79410_ADDRESS);
|
|
|
|
|
|
-//Set the pins on the I2C chip used for LCD connections
|
|
|
|
-//ADDR,EN,R/W,RS,D4,D5,D6,D7
|
|
|
|
-
|
|
|
|
-
|
|
|
|
int temp; //
|
|
int temp; //
|
|
-
|
|
|
|
|
|
+uint8_t customKey;
|
|
|
|
+bool decimalPoint=false; //used to test for more than one press of * key (decimal point)
|
|
float BatteryLife = 0; //
|
|
float BatteryLife = 0; //
|
|
float BatteryLifePrevious = 0; //
|
|
float BatteryLifePrevious = 0; //
|
|
float Seconds = 0; //time variable used in Battery Capacity Mode (BC)
|
|
float Seconds = 0; //time variable used in Battery Capacity Mode (BC)
|
|
float SecondsLog = 0; //variable used for data logging of the time in seconds
|
|
float SecondsLog = 0; //variable used for data logging of the time in seconds
|
|
float BatteryCutoffVolts; //used to set battery discharge cut-off voltage
|
|
float BatteryCutoffVolts; //used to set battery discharge cut-off voltage
|
|
float MaxBatteryCurrent = 1.0; //maximum battery current allowed for Battery Capacity Testing
|
|
float MaxBatteryCurrent = 1.0; //maximum battery current allowed for Battery Capacity Testing
|
|
-
|
|
|
|
int stopSeconds; //store for seconds when timer stopped
|
|
int stopSeconds; //store for seconds when timer stopped
|
|
-
|
|
|
|
int CP = 8; //cursor start position
|
|
int CP = 8; //cursor start position
|
|
-
|
|
|
|
boolean toggle = false; //used for toggle of Load On/Off button
|
|
boolean toggle = false; //used for toggle of Load On/Off button
|
|
-
|
|
|
|
unsigned long controlVoltage = 0; //used for DAC to control MOSFET
|
|
unsigned long controlVoltage = 0; //used for DAC to control MOSFET
|
|
|
|
|
|
long current = 0; //variable used by ADC for measuring the current
|
|
long current = 0; //variable used by ADC for measuring the current
|
|
@@ -95,9 +78,7 @@ float setCurrent = 0; //variable used for the set curren
|
|
float setPower = 0; //variable used for the set power of the load
|
|
float setPower = 0; //variable used for the set power of the load
|
|
float setResistance = 0; //variable used for the set resistance of the load
|
|
float setResistance = 0; //variable used for the set resistance of the load
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-int Load = 0; //Load On/Off flag
|
|
|
|
|
|
+bool Load = 0; //Load On/Off flag
|
|
|
|
|
|
float setControlCurrent = 0; //variable used to set the temporary store for control current required
|
|
float setControlCurrent = 0; //variable used to set the temporary store for control current required
|
|
|
|
|
|
@@ -220,9 +201,9 @@ void isr()
|
|
|
|
|
|
void toggle_usb(void){
|
|
void toggle_usb(void){
|
|
if (usb_enable){
|
|
if (usb_enable){
|
|
- writeNum2("pusb.pic",(int) pic_usb_grey);
|
|
|
|
|
|
+ writeNum2("pusb.pic",(int) PIC_USB_GRAY);
|
|
}else{
|
|
}else{
|
|
- writeNum2("pusb.pic",(int) pic_usb_black);
|
|
|
|
|
|
+ writeNum2("pusb.pic",(int) PIC_USB_BLACK);
|
|
}
|
|
}
|
|
usb_enable=!usb_enable;
|
|
usb_enable=!usb_enable;
|
|
}
|
|
}
|
|
@@ -231,72 +212,37 @@ void toggle_usb(void){
|
|
|
|
|
|
//---------------------------------Initial Set up---------------------------------------
|
|
//---------------------------------Initial Set up---------------------------------------
|
|
void setup() {
|
|
void setup() {
|
|
- //used for testing only
|
|
|
|
- Wire.begin(); //join i2c bus (address optional for master)
|
|
|
|
- Wire.setClock(400000L); //sets bit rate to 400KHz
|
|
|
|
|
|
+ Serial.begin(38400);
|
|
|
|
+ Serial1.begin(38400);
|
|
pinMode(rxPin, INPUT);
|
|
pinMode(rxPin, INPUT);
|
|
pinMode(txPin, OUTPUT);
|
|
pinMode(txPin, OUTPUT);
|
|
- nexSerial.begin(38400);
|
|
|
|
- Serial.begin(38400);
|
|
|
|
- analogReference(INTERNAL2V5);
|
|
|
|
|
|
+ Serial1.begin(38400);
|
|
|
|
+ Wire.begin(); //join i2c bus (address optional for master)
|
|
|
|
+ Wire.setClock(400000L); //sets bit rate to 400KHz
|
|
|
|
+
|
|
/* Register the pop event callback function of the current button component. */
|
|
/* Register the pop event callback function of the current button component. */
|
|
delay(100);
|
|
delay(100);
|
|
unsigned long _tmr1;
|
|
unsigned long _tmr1;
|
|
_tmr1 = millis();
|
|
_tmr1 = millis();
|
|
- while(nexSerial.available() > 0){ // Read the Serial until it is empty. This is used to clear Serial buffer
|
|
|
|
|
|
+ while(Serial1.available() > 0){ // Read the Serial until it is empty. This is used to clear Serial buffer
|
|
if((millis() - _tmr1) > 400UL){ // Reading... Waiting... But not forever......
|
|
if((millis() - _tmr1) > 400UL){ // Reading... Waiting... But not forever......
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
- nexSerial.read(); // Read and delete bytes
|
|
|
|
|
|
+ Serial1.read(); // Read and delete bytes
|
|
}
|
|
}
|
|
memset(line_input,' ',10);
|
|
memset(line_input,' ',10);
|
|
- CurrentCutOff = EEPROM.read(0x00);
|
|
|
|
- PowerCutOff = EEPROM.read(0x20);
|
|
|
|
- tempCutOff = EEPROM.read(0x40);
|
|
|
|
|
|
+ CurrentCutOff = EEPROM.read(CURRENTCUTOFF_ADDRESS);
|
|
|
|
+ PowerCutOff = EEPROM.read(POWERCUTOFF_ADDRESS);
|
|
|
|
+ tempCutOff = EEPROM.read(TEMPCUTOFF_ADDRESS);
|
|
MCP342x::generalCallReset(); //Reset devices
|
|
MCP342x::generalCallReset(); //Reset devices
|
|
pinMode (pinA, INPUT);
|
|
pinMode (pinA, INPUT);
|
|
pinMode (pinB, INPUT);
|
|
pinMode (pinB, INPUT);
|
|
- pinMode (CursorPos, INPUT_PULLUP);
|
|
|
|
- pinMode (LoadOnOff, INPUT_PULLUP);
|
|
|
|
-
|
|
|
|
- pinMode (TriggerPulse, INPUT_PULLUP);
|
|
|
|
- byte error, address;
|
|
|
|
- int nDevices;
|
|
|
|
-nDevices = 0;
|
|
|
|
- for(address = 1; address < 127; address++ )
|
|
|
|
- {
|
|
|
|
- // The i2c_scanner uses the return value of
|
|
|
|
- // the Write.endTransmisstion to see if
|
|
|
|
- // a device did acknowledge to the address.
|
|
|
|
- Wire.beginTransmission(address);
|
|
|
|
- error = Wire.endTransmission();
|
|
|
|
-
|
|
|
|
- if (error == 0)
|
|
|
|
- {
|
|
|
|
- Serial.print("I2C device found at address 0x");
|
|
|
|
- if (address<16)
|
|
|
|
- Serial.print("0");
|
|
|
|
- Serial.print(address,HEX);
|
|
|
|
- Serial.println(" !");
|
|
|
|
-
|
|
|
|
- nDevices++;
|
|
|
|
- }
|
|
|
|
- else if (error==4)
|
|
|
|
- {
|
|
|
|
- Serial.print("Unknown error at address 0x");
|
|
|
|
- if (address<16)
|
|
|
|
- Serial.print("0");
|
|
|
|
- Serial.println(address,HEX);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- if (nDevices == 0)
|
|
|
|
- Serial.println("No I2C devices found\n");
|
|
|
|
- else
|
|
|
|
- Serial.println("done\n");
|
|
|
|
-
|
|
|
|
- pinMode (fan, OUTPUT);
|
|
|
|
|
|
+ pinMode (CURSORPOS_PIN, INPUT_PULLUP);
|
|
|
|
+ pinMode (LOADONOFF_PIN, INPUT_PULLUP);
|
|
|
|
+ pinMode (TRIGGERPULSE_PIN, INPUT_PULLUP);
|
|
|
|
+ pinMode (FAN_PIN, OUTPUT);
|
|
//TCCR2B = (TCCR2B & 0b11111000) | 1; //change PWM to above hearing (Kenneth Larvsen recommendation)
|
|
//TCCR2B = (TCCR2B & 0b11111000) | 1; //change PWM to above hearing (Kenneth Larvsen recommendation)
|
|
- pinMode (temperature, INPUT);
|
|
|
|
|
|
+ pinMode (TEMP_PIN, INPUT);
|
|
setVoltage(0,false); //reset DAC to zero for no output current set at Switch On
|
|
setVoltage(0,false); //reset DAC to zero for no output current set at Switch On
|
|
analogReference(INTERNAL); //use Arduino internal reference for tempurature monitoring
|
|
analogReference(INTERNAL); //use Arduino internal reference for tempurature monitoring
|
|
attachInterrupt(digitalPinToInterrupt(pinA), isr, LOW);
|
|
attachInterrupt(digitalPinToInterrupt(pinA), isr, LOW);
|
|
@@ -308,18 +254,18 @@ nDevices = 0;
|
|
writeNum2("t2.xcen",(int) 1);
|
|
writeNum2("t2.xcen",(int) 1);
|
|
writeNum2("t3.xcen",(int) 1);
|
|
writeNum2("t3.xcen",(int) 1);
|
|
memcpy(line0,(char*)"SCULLCOM",9);
|
|
memcpy(line0,(char*)"SCULLCOM",9);
|
|
- print_chars2(0,9);
|
|
|
|
|
|
+ print_line(0,9);
|
|
|
|
|
|
memcpy(line1,(char*)"Hobby Electronics",18);
|
|
memcpy(line1,(char*)"Hobby Electronics",18);
|
|
- print_chars2(1,18);
|
|
|
|
|
|
+ print_line(1,18);
|
|
|
|
|
|
memcpy(line2,(char*)"DC Electronic Load",19);
|
|
memcpy(line2,(char*)"DC Electronic Load",19);
|
|
- print_chars2(2,19);
|
|
|
|
|
|
+ print_line(2,19);
|
|
|
|
|
|
memcpy(line3,(char*)"Ver. ",5);
|
|
memcpy(line3,(char*)"Ver. ",5);
|
|
memcpy(line3+5,(char*)DC_LOAD_VER,2);
|
|
memcpy(line3+5,(char*)DC_LOAD_VER,2);
|
|
memcpy(line3+7,(char*)" (Nextion)",11);
|
|
memcpy(line3+7,(char*)" (Nextion)",11);
|
|
- print_chars2(3,21);
|
|
|
|
|
|
+ print_line(3,21);
|
|
memcpy(line_current," ",1);
|
|
memcpy(line_current," ",1);
|
|
memcpy(line_volt," ",1);
|
|
memcpy(line_volt," ",1);
|
|
memcpy(line_power," ",1);
|
|
memcpy(line_power," ",1);
|
|
@@ -332,7 +278,7 @@ nDevices = 0;
|
|
writeNum2("t3.xcen",(int) 0); //3000 mSec delay for intro display
|
|
writeNum2("t3.xcen",(int) 0); //3000 mSec delay for intro display
|
|
screen_clear(' ');
|
|
screen_clear(' ');
|
|
setupLimits();
|
|
setupLimits();
|
|
- delay(3000);
|
|
|
|
|
|
+ delay(2000);
|
|
screen_clear(' ');
|
|
screen_clear(' ');
|
|
|
|
|
|
last_time = 0; //set the last_time to 0 at the start (Transicent Mode)
|
|
last_time = 0; //set the last_time to 0 at the start (Transicent Mode)
|
|
@@ -358,7 +304,7 @@ void loop() {
|
|
}else{
|
|
}else{
|
|
|
|
|
|
readKeypadInput(); //read Keypad entry
|
|
readKeypadInput(); //read Keypad entry
|
|
- OnOffcurrentState = digitalRead(LoadOnOff);
|
|
|
|
|
|
+ OnOffcurrentState = digitalRead(LOADONOFF_PIN);
|
|
if (OnOffcurrentState != OnOfflastFlickerableState) {
|
|
if (OnOffcurrentState != OnOfflastFlickerableState) {
|
|
OnOfflastDebounceTime = millis();
|
|
OnOfflastDebounceTime = millis();
|
|
OnOfflastFlickerableState = OnOffcurrentState;
|
|
OnOfflastFlickerableState = OnOffcurrentState;
|
|
@@ -415,7 +361,6 @@ void readKeypadInput (void) {
|
|
}
|
|
}
|
|
|
|
|
|
if(customKey == DIGIT_SETUP){ //check if Set-Up Mode Selected
|
|
if(customKey == DIGIT_SETUP){ //check if Set-Up Mode Selected
|
|
- delay(200);
|
|
|
|
toggle = true;
|
|
toggle = true;
|
|
customKey=NO_KEY; //switch Load OFF
|
|
customKey=NO_KEY; //switch Load OFF
|
|
LoadSwitch();
|
|
LoadSwitch();
|
|
@@ -442,7 +387,7 @@ void readKeypadInput (void) {
|
|
if(customKey == DIGIT_CURRENT){ //check if Constant Current button pressed
|
|
if(customKey == DIGIT_CURRENT){ //check if Constant Current button pressed
|
|
toggle = false; //switch Load OFF
|
|
toggle = false; //switch Load OFF
|
|
color_load(0);
|
|
color_load(0);
|
|
- print_chars2(0,20);
|
|
|
|
|
|
+ print_line(0,20);
|
|
Current(); //if selected go to Constant Current Selected routine
|
|
Current(); //if selected go to Constant Current Selected routine
|
|
encoderPosition = 0; //reset encoder reading to zero
|
|
encoderPosition = 0; //reset encoder reading to zero
|
|
index = 0;
|
|
index = 0;
|
|
@@ -454,7 +399,7 @@ void readKeypadInput (void) {
|
|
if(customKey == DIGIT_POWER){ //check if Constant Power button pressed
|
|
if(customKey == DIGIT_POWER){ //check if Constant Power button pressed
|
|
toggle = false; //switch Load OFF
|
|
toggle = false; //switch Load OFF
|
|
color_load(0);
|
|
color_load(0);
|
|
- print_chars2(0,20);
|
|
|
|
|
|
+ print_line(0,20);
|
|
Power(); //if selected go to Constant Power Selected routine
|
|
Power(); //if selected go to Constant Power Selected routine
|
|
encoderPosition = 0; //reset encoder reading to zero
|
|
encoderPosition = 0; //reset encoder reading to zero
|
|
index = 0;
|
|
index = 0;
|
|
@@ -466,7 +411,7 @@ void readKeypadInput (void) {
|
|
if(customKey == DIGIT_RESISTANS){ //check if Constant Resistance button pressed
|
|
if(customKey == DIGIT_RESISTANS){ //check if Constant Resistance button pressed
|
|
toggle = false; //switch Load OFF
|
|
toggle = false; //switch Load OFF
|
|
color_load(0);
|
|
color_load(0);
|
|
- print_chars2(0,20);
|
|
|
|
|
|
+ print_line(0,20);
|
|
Resistance(); //if selected go to Constant Resistance Selected routine
|
|
Resistance(); //if selected go to Constant Resistance Selected routine
|
|
encoderPosition = 0; //reset encoder reading to zero
|
|
encoderPosition = 0; //reset encoder reading to zero
|
|
index = 0;
|
|
index = 0;
|
|
@@ -484,7 +429,7 @@ void readKeypadInput (void) {
|
|
decimalPoint = false; //clear decimal point test character reset
|
|
decimalPoint = false; //clear decimal point test character reset
|
|
if (exitMode == 1){ //if NO battery type selected revert to CC Mode
|
|
if (exitMode == 1){ //if NO battery type selected revert to CC Mode
|
|
color_load(0);
|
|
color_load(0);
|
|
- print_chars2(0,20);
|
|
|
|
|
|
+ print_line(0,20);
|
|
Current(); //if selected go to Constant Current Selected routine
|
|
Current(); //if selected go to Constant Current Selected routine
|
|
encoderPosition = 0; //reset encoder reading to zero
|
|
encoderPosition = 0; //reset encoder reading to zero
|
|
customKey = DIGIT_CURRENT;
|
|
customKey = DIGIT_CURRENT;
|
|
@@ -492,9 +437,9 @@ void readKeypadInput (void) {
|
|
else
|
|
else
|
|
{
|
|
{
|
|
memcpy(line2+16,(char*)BatteryType.c_str(),4);
|
|
memcpy(line2+16,(char*)BatteryType.c_str(),4);
|
|
- print_chars2(2,20);
|
|
|
|
|
|
+ print_line(2,20);
|
|
color_load(0);
|
|
color_load(0);
|
|
- print_chars2(0,20);
|
|
|
|
|
|
+ print_line(0,20);
|
|
timer.reset(); //reset timer
|
|
timer.reset(); //reset timer
|
|
BatteryLifePrevious = 0;
|
|
BatteryLifePrevious = 0;
|
|
CP = 9; //set cursor position
|
|
CP = 9; //set cursor position
|
|
@@ -591,7 +536,7 @@ void powerLevelCutOff (void) {
|
|
|
|
|
|
print_chars(3,0,(char*)"Exceeded Power ",20);
|
|
print_chars(3,0,(char*)"Exceeded Power ",20);
|
|
color_load(0);
|
|
color_load(0);
|
|
- print_chars2(0,20);
|
|
|
|
|
|
+ print_line(0,20);
|
|
toggle = false; //switch Load Off
|
|
toggle = false; //switch Load Off
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -606,8 +551,6 @@ void batteryCurrentLimitValue (void) {
|
|
|
|
|
|
//----------------------Display Rotary Encoder Input Reading on LCD---------------------------
|
|
//----------------------Display Rotary Encoder Input Reading on LCD---------------------------
|
|
void displayEncoderReading (void) {
|
|
void displayEncoderReading (void) {
|
|
-
|
|
|
|
- //lcd.setCursor(8,2); //start position of setting entry
|
|
|
|
char buff[6];
|
|
char buff[6];
|
|
uint8_t cursor_pos=8;
|
|
uint8_t cursor_pos=8;
|
|
/*
|
|
/*
|
|
@@ -628,8 +571,6 @@ void displayEncoderReading (void) {
|
|
dtostrf(reading, 5, 3, buff);
|
|
dtostrf(reading, 5, 3, buff);
|
|
print_chars(1,cursor_pos++,(char*)buff,5);
|
|
print_chars(1,cursor_pos++,(char*)buff,5);
|
|
}
|
|
}
|
|
- //lcd.setCursor (CP, 2); //sets cursor position
|
|
|
|
- //lcd.cursor(); //show cursor on LCD
|
|
|
|
}
|
|
}
|
|
|
|
|
|
//--------------------------Cursor Position-------------------------------------------------------
|
|
//--------------------------Cursor Position-------------------------------------------------------
|
|
@@ -644,9 +585,9 @@ void CursorPosition(void) {
|
|
unitPosition = 10;
|
|
unitPosition = 10;
|
|
}
|
|
}
|
|
|
|
|
|
- if (digitalRead(CursorPos) == LOW) {
|
|
|
|
|
|
+ if (digitalRead(CURSORPOS_PIN) == LOW) {
|
|
|
|
|
|
- delay(200); //simple key bounce delay
|
|
|
|
|
|
+ delay(DEBOUNCE_DELAY); //simple key bounce delay
|
|
CP = CP + 1;
|
|
CP = CP + 1;
|
|
if (CP == unitPosition + 1 ) {
|
|
if (CP == unitPosition + 1 ) {
|
|
CP = CP + 1;
|
|
CP = CP + 1;
|
|
@@ -794,7 +735,7 @@ void batteryCapacityloop (void) {
|
|
}
|
|
}
|
|
|
|
|
|
memcpy(line3+13,"mAh",3);
|
|
memcpy(line3+13,"mAh",3);
|
|
- print_chars2(3,20);
|
|
|
|
|
|
+ print_line(3,20);
|
|
BatteryLifePrevious = BatteryLife; //update displayed battery capacity on LCD
|
|
BatteryLifePrevious = BatteryLife; //update displayed battery capacity on LCD
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -821,13 +762,13 @@ void batteryCapacityloop (void) {
|
|
|
|
|
|
//--------------------------------------------------Fan Control----------------------------------------------------------
|
|
//--------------------------------------------------Fan Control----------------------------------------------------------
|
|
void fanControl (void) {
|
|
void fanControl (void) {
|
|
- temp = analogRead(temperature);
|
|
|
|
|
|
+ temp = analogRead(TEMP_PIN);
|
|
temp = temp * 0.107421875/2; // convert to Celsius
|
|
temp = temp * 0.107421875/2; // convert to Celsius
|
|
|
|
|
|
if (temp >= 40){ //if temperature 40 degree C or above turn fan on.
|
|
if (temp >= 40){ //if temperature 40 degree C or above turn fan on.
|
|
- digitalWrite(fan, HIGH);
|
|
|
|
|
|
+ digitalWrite(FAN_PIN, HIGH);
|
|
} else {
|
|
} else {
|
|
- digitalWrite(fan, LOW); //otherwise turn fan turned off
|
|
|
|
|
|
+ digitalWrite(FAN_PIN, LOW); //otherwise turn fan turned off
|
|
}
|
|
}
|
|
|
|
|
|
memcpy(temperature_val,(char*)String(temp).c_str(),2);
|
|
memcpy(temperature_val,(char*)String(temp).c_str(),2);
|
|
@@ -842,7 +783,7 @@ void fanControl (void) {
|
|
//-----------------------Toggle Current Load ON or OFF------------------------------
|
|
//-----------------------Toggle Current Load ON or OFF------------------------------
|
|
void LoadSwitch(void) {
|
|
void LoadSwitch(void) {
|
|
|
|
|
|
- delay(200); //simple key bounce delay
|
|
|
|
|
|
+
|
|
|
|
|
|
if(toggle)
|
|
if(toggle)
|
|
{
|
|
{
|
|
@@ -850,7 +791,7 @@ void LoadSwitch(void) {
|
|
|
|
|
|
current_instruction = 0; //reset current instruction for Transient List Mode to zero
|
|
current_instruction = 0; //reset current instruction for Transient List Mode to zero
|
|
last_time = 0; //reset last time to zero
|
|
last_time = 0; //reset last time to zero
|
|
- transientPeriod = 0; //reset transient period time to zero
|
|
|
|
|
|
+ //transientPeriod = 0; //reset transient period time to zero
|
|
setCurrent = 0; //reset setCurrent to zero
|
|
setCurrent = 0; //reset setCurrent to zero
|
|
toggle = !toggle;
|
|
toggle = !toggle;
|
|
Load = 0;
|
|
Load = 0;
|
|
@@ -862,19 +803,20 @@ void LoadSwitch(void) {
|
|
toggle = !toggle;
|
|
toggle = !toggle;
|
|
Load = 1;
|
|
Load = 1;
|
|
}
|
|
}
|
|
|
|
+ delay(DEBOUNCE_DELAY); //simple key bounce delay
|
|
}
|
|
}
|
|
|
|
|
|
//-----------------------Select Constant Current LCD set up--------------------------------
|
|
//-----------------------Select Constant Current LCD set up--------------------------------
|
|
void Current(void) {
|
|
void Current(void) {
|
|
Mode = MODE_CC;
|
|
Mode = MODE_CC;
|
|
memcpy(line0,(char*)"DC LOAD ",12);
|
|
memcpy(line0,(char*)"DC LOAD ",12);
|
|
- print_chars2(0,20);
|
|
|
|
|
|
+ print_line(0,20);
|
|
writeNum2("t0.xcen",(uint16_t) 0);
|
|
writeNum2("t0.xcen",(uint16_t) 0);
|
|
print_chars(1,0,(char*)"Set I = A",20);
|
|
print_chars(1,0,(char*)"Set I = A",20);
|
|
memset(line2,' ',20);
|
|
memset(line2,' ',20);
|
|
- print_chars2(2,20);
|
|
|
|
|
|
+ print_line(2,20);
|
|
memset(line3,' ',20);
|
|
memset(line3,' ',20);
|
|
- print_chars2(3,20);
|
|
|
|
|
|
+ print_line(3,20);
|
|
CP = 9; //sets cursor starting position to units.
|
|
CP = 9; //sets cursor starting position to units.
|
|
setmode() ;
|
|
setmode() ;
|
|
}
|
|
}
|
|
@@ -884,12 +826,12 @@ void Power(void) {
|
|
Mode = MODE_CP;
|
|
Mode = MODE_CP;
|
|
writeNum2("t0.xcen",(int) 0);
|
|
writeNum2("t0.xcen",(int) 0);
|
|
memcpy(line0,(char*)"DC LOAD ",12);
|
|
memcpy(line0,(char*)"DC LOAD ",12);
|
|
- print_chars2(0,20);
|
|
|
|
|
|
+ print_line(0,20);
|
|
print_chars(1,0,(char*)"Set W = W",20);
|
|
print_chars(1,0,(char*)"Set W = W",20);
|
|
memset(line2,' ',20);
|
|
memset(line2,' ',20);
|
|
- print_chars2(2,20);
|
|
|
|
|
|
+ print_line(2,20);
|
|
memset(line3,' ',20);
|
|
memset(line3,' ',20);
|
|
- print_chars2(3,20);
|
|
|
|
|
|
+ print_line(3,20);
|
|
CP = 10; //sets cursor starting position to units.
|
|
CP = 10; //sets cursor starting position to units.
|
|
setmode() ;
|
|
setmode() ;
|
|
}
|
|
}
|
|
@@ -899,12 +841,12 @@ void Resistance(void) {
|
|
Mode = MODE_CR;
|
|
Mode = MODE_CR;
|
|
writeNum2("t0.xcen",(int) 0);
|
|
writeNum2("t0.xcen",(int) 0);
|
|
memcpy(line0,(char*)"DC LOAD ",12);
|
|
memcpy(line0,(char*)"DC LOAD ",12);
|
|
- print_chars2(0,20);
|
|
|
|
|
|
+ print_line(0,20);
|
|
print_chars(1,0,(char*)"Set R = R",20);
|
|
print_chars(1,0,(char*)"Set R = R",20);
|
|
memset(line2,' ',20);
|
|
memset(line2,' ',20);
|
|
- print_chars2(2,20);
|
|
|
|
|
|
+ print_line(2,20);
|
|
memset(line3,' ',20);
|
|
memset(line3,' ',20);
|
|
- print_chars2(3,20);
|
|
|
|
|
|
+ print_line(3,20);
|
|
CP = 10; //sets cursor starting position to units.
|
|
CP = 10; //sets cursor starting position to units.
|
|
setmode() ;
|
|
setmode() ;
|
|
//sets cursor starting position to units.
|
|
//sets cursor starting position to units.
|
|
@@ -917,12 +859,12 @@ void BatteryCapacity(void) {
|
|
writeNum2("t0.xcen",0);
|
|
writeNum2("t0.xcen",0);
|
|
memcpy(line0,"BATTERY ",20);
|
|
memcpy(line0,"BATTERY ",20);
|
|
memcpy(line0+8,(char *)BatteryType.c_str(),4);
|
|
memcpy(line0+8,(char *)BatteryType.c_str(),4);
|
|
- print_chars2(0,20);
|
|
|
|
|
|
+ print_line(0,20);
|
|
print_chars(1,0,(char*)"Set I = A",20);
|
|
print_chars(1,0,(char*)"Set I = A",20);
|
|
memset(line2,' ',20);
|
|
memset(line2,' ',20);
|
|
- print_chars2(2,20);
|
|
|
|
|
|
+ print_line(2,20);
|
|
memset(line3,' ',20);
|
|
memset(line3,' ',20);
|
|
- print_chars2(3,20);
|
|
|
|
|
|
+ print_line(3,20);
|
|
CP = 9; //sets cursor starting position to units.
|
|
CP = 9; //sets cursor starting position to units.
|
|
setmode() ;
|
|
setmode() ;
|
|
}
|
|
}
|
|
@@ -1012,10 +954,10 @@ void batteryTypeSelected (void) {
|
|
dtostrf(BatteryCutoffVolts, 4, 2, buff);
|
|
dtostrf(BatteryCutoffVolts, 4, 2, buff);
|
|
memcpy(line3+6,buff,4);
|
|
memcpy(line3+6,buff,4);
|
|
memcpy(line3+11," volts",6);
|
|
memcpy(line3+11," volts",6);
|
|
- print_chars2(0,21);
|
|
|
|
- print_chars2(1,21);
|
|
|
|
- print_chars2(2,21);
|
|
|
|
- print_chars2(3,21);
|
|
|
|
|
|
+ print_line(0,21);
|
|
|
|
+ print_line(1,21);
|
|
|
|
+ print_line(2,21);
|
|
|
|
+ print_line(3,21);
|
|
delay(2000);
|
|
delay(2000);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -1032,19 +974,7 @@ void setBatteryCutOff (void) {
|
|
BatteryCutoffVolts = x;
|
|
BatteryCutoffVolts = x;
|
|
screen_clear(' ');
|
|
screen_clear(' ');
|
|
}
|
|
}
|
|
-void wait_for_key(bool wait){
|
|
|
|
-
|
|
|
|
- bool waiting = true;
|
|
|
|
|
|
|
|
- while (customKey==0x00 && (waiting)){
|
|
|
|
- waiting = wait;
|
|
|
|
- delay(10);
|
|
|
|
- while (customKey==0x00 ){
|
|
|
|
- serialEvent();
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-}
|
|
|
|
//------------------------Key input used for Battery Cut-Off and Transient Mode------------------------
|
|
//------------------------Key input used for Battery Cut-Off and Transient Mode------------------------
|
|
void inputValue (int r=0){
|
|
void inputValue (int r=0){
|
|
|
|
|
|
@@ -1105,7 +1035,7 @@ void transientMode (void) {
|
|
print_chars(0,4,(char*)"Transient Mode",15);
|
|
print_chars(0,4,(char*)"Transient Mode",15);
|
|
memcpy(line1,(char *)"Set Low I=",11);
|
|
memcpy(line1,(char *)"Set Low I=",11);
|
|
memcpy(line1+19,(char *)"A " ,2);
|
|
memcpy(line1+19,(char *)"A " ,2);
|
|
- print_chars2(1,0);
|
|
|
|
|
|
+ print_line(1,0);
|
|
inputValue(1);
|
|
inputValue(1);
|
|
|
|
|
|
if(x >= CurrentCutOff){
|
|
if(x >= CurrentCutOff){
|
|
@@ -1123,7 +1053,7 @@ void transientMode (void) {
|
|
z = 11;
|
|
z = 11;
|
|
memcpy(line2,(char *)"Set High I=",11);
|
|
memcpy(line2,(char *)"Set High I=",11);
|
|
memcpy(line2+19,(char *)"A " ,2);
|
|
memcpy(line2+19,(char *)"A " ,2);
|
|
- print_chars2(2,0);
|
|
|
|
|
|
+ print_line(2,0);
|
|
inputValue(2);
|
|
inputValue(2);
|
|
if(x >= CurrentCutOff){
|
|
if(x >= CurrentCutOff){
|
|
HighCurrent = CurrentCutOff;
|
|
HighCurrent = CurrentCutOff;
|
|
@@ -1140,7 +1070,7 @@ void transientMode (void) {
|
|
z = 11;
|
|
z = 11;
|
|
memcpy(line3,(char *)"Set Time =",11);
|
|
memcpy(line3,(char *)"Set Time =",11);
|
|
memcpy(line3+16,(char *)"mSec " ,5);
|
|
memcpy(line3+16,(char *)"mSec " ,5);
|
|
- print_chars2(3,0);
|
|
|
|
|
|
+ print_line(3,0);
|
|
inputValue(3);
|
|
inputValue(3);
|
|
transientPeriod = x;
|
|
transientPeriod = x;
|
|
r++;
|
|
r++;
|
|
@@ -1150,7 +1080,7 @@ void transientMode (void) {
|
|
}else{
|
|
}else{
|
|
|
|
|
|
memset(line3,' ',20);
|
|
memset(line3,' ',20);
|
|
- print_chars2(3,0);
|
|
|
|
|
|
+ print_line(3,0);
|
|
}
|
|
}
|
|
|
|
|
|
screen_clear(' ');
|
|
screen_clear(' ');
|
|
@@ -1173,15 +1103,15 @@ void transientType (void) {
|
|
screen_clear(' ');
|
|
screen_clear(' ');
|
|
writeNum2("t0.xcen",(int) 0); //print SCULLCOM to display with 5 leading spaces (you can change to your own)
|
|
writeNum2("t0.xcen",(int) 0); //print SCULLCOM to display with 5 leading spaces (you can change to your own)
|
|
memcpy(line0,(char*)"Transient Mode",15);
|
|
memcpy(line0,(char*)"Transient Mode",15);
|
|
- print_chars2(0,0);
|
|
|
|
|
|
+ print_line(0,0);
|
|
memcpy(line1,(char*)"1 = Continuous",15);
|
|
memcpy(line1,(char*)"1 = Continuous",15);
|
|
- print_chars2(1,0);
|
|
|
|
|
|
+ print_line(1,0);
|
|
memcpy(line2,(char*)"2 = Toggle",10);
|
|
memcpy(line2,(char*)"2 = Toggle",10);
|
|
memcpy(line2+11,(char*)"3 = Pulse",9);
|
|
memcpy(line2+11,(char*)"3 = Pulse",9);
|
|
- print_chars2(2,0);
|
|
|
|
|
|
+ print_line(2,0);
|
|
memcpy(line3,(char*)"4 = List",8);
|
|
memcpy(line3,(char*)"4 = List",8);
|
|
memcpy(line3+11,(char*)"5 = Exit",9);
|
|
memcpy(line3+11,(char*)"5 = Exit",9);
|
|
- print_chars2(3,0);
|
|
|
|
|
|
+ print_line(3,0);
|
|
while ( customKey == 0x00 ||
|
|
while ( customKey == 0x00 ||
|
|
customKey == DIGIT_6 ||
|
|
customKey == DIGIT_6 ||
|
|
customKey == DIGIT_7 ||
|
|
customKey == DIGIT_7 ||
|
|
@@ -1228,7 +1158,7 @@ void transient (void) {
|
|
char buff[6]={0x00};
|
|
char buff[6]={0x00};
|
|
if(Mode == MODE_TC || Mode == MODE_TP || Mode == MODE_TT || Mode == MODE_TL){
|
|
if(Mode == MODE_TC || Mode == MODE_TP || Mode == MODE_TT || Mode == MODE_TL){
|
|
memcpy(line0,(char*)"DC LOAD ",8);
|
|
memcpy(line0,(char*)"DC LOAD ",8);
|
|
- print_chars2(0,20);
|
|
|
|
|
|
+ print_line(0,20);
|
|
if(Mode != MODE_TL){
|
|
if(Mode != MODE_TL){
|
|
memcpy(line2,"Lo= A Hi= A",20);
|
|
memcpy(line2,"Lo= A Hi= A",20);
|
|
dtostrf(LowCurrent, 4, 3, buff);
|
|
dtostrf(LowCurrent, 4, 3, buff);
|
|
@@ -1251,8 +1181,8 @@ void transient (void) {
|
|
memcpy(line3," ",2);
|
|
memcpy(line3," ",2);
|
|
|
|
|
|
}
|
|
}
|
|
- print_chars2(2,20);
|
|
|
|
- print_chars2(3,20);
|
|
|
|
|
|
+ print_line(2,20);
|
|
|
|
+ print_line(3,20);
|
|
}
|
|
}
|
|
delay(1);
|
|
delay(1);
|
|
}
|
|
}
|
|
@@ -1263,11 +1193,11 @@ void transientListSetup(){
|
|
screen_clear(' ');
|
|
screen_clear(' ');
|
|
writeNum2("t0.xcen",(int) 0); //print SCULLCOM to display with 5 leading spaces (you can change to your own)
|
|
writeNum2("t0.xcen",(int) 0); //print SCULLCOM to display with 5 leading spaces (you can change to your own)
|
|
memcpy(line0,(char*)"Setup Transient List",21);
|
|
memcpy(line0,(char*)"Setup Transient List",21);
|
|
- print_chars2(0,0);
|
|
|
|
|
|
+ print_line(0,0);
|
|
memcpy(line1,(char*)"Enter Number in List",21);
|
|
memcpy(line1,(char*)"Enter Number in List",21);
|
|
- print_chars2(1,0);
|
|
|
|
|
|
+ print_line(1,0);
|
|
memcpy(line2,(char*)"(between 2 to 10 max",21);
|
|
memcpy(line2,(char*)"(between 2 to 10 max",21);
|
|
- print_chars2(2,0);
|
|
|
|
|
|
+ print_line(2,0);
|
|
y = 0;
|
|
y = 0;
|
|
z = 0;
|
|
z = 0;
|
|
inputValue(3);
|
|
inputValue(3);
|
|
@@ -1282,8 +1212,8 @@ void transientListSetup(){
|
|
itoa(i+1 ,buff,10);
|
|
itoa(i+1 ,buff,10);
|
|
memcpy(line0+12,buff,length);
|
|
memcpy(line0+12,buff,length);
|
|
memcpy(line1," A",16);
|
|
memcpy(line1," A",16);
|
|
- print_chars2(0,0);
|
|
|
|
- print_chars2(1,0);
|
|
|
|
|
|
+ print_line(0,0);
|
|
|
|
+ print_line(1,0);
|
|
|
|
|
|
y = 0;
|
|
y = 0;
|
|
z = 0;
|
|
z = 0;
|
|
@@ -1296,8 +1226,8 @@ void transientListSetup(){
|
|
|
|
|
|
memcpy(line2+12,buff,length);
|
|
memcpy(line2+12,buff,length);
|
|
memcpy(line3," mSec",19);
|
|
memcpy(line3," mSec",19);
|
|
- print_chars2(2,0);
|
|
|
|
- print_chars2(3,0);
|
|
|
|
|
|
+ print_line(2,0);
|
|
|
|
+ print_line(3,0);
|
|
y = 0;
|
|
y = 0;
|
|
z = 0;
|
|
z = 0;
|
|
inputValue(3); //get the users input value
|
|
inputValue(3); //get the users input value
|
|
@@ -1311,7 +1241,7 @@ void transientListSetup(){
|
|
//-------------------------------------Transcient Load Toggel-------------------------------------------
|
|
//-------------------------------------Transcient Load Toggel-------------------------------------------
|
|
void transientLoadToggle(){
|
|
void transientLoadToggle(){
|
|
char buff[5] = {0x00};
|
|
char buff[5] = {0x00};
|
|
- if(Mode == MODE_TC){
|
|
|
|
|
|
+ if(Mode == MODE_TC && Load == 1){
|
|
current_time = micros(); //get the current time in micro seconds()
|
|
current_time = micros(); //get the current time in micro seconds()
|
|
if (last_time == 0){
|
|
if (last_time == 0){
|
|
last_time = current_time;
|
|
last_time = current_time;
|
|
@@ -1324,7 +1254,7 @@ void transientLoadToggle(){
|
|
transientSwitch(LowCurrent, true);
|
|
transientSwitch(LowCurrent, true);
|
|
dtostrf(LowCurrent, 4, 3, buff);
|
|
dtostrf(LowCurrent, 4, 3, buff);
|
|
memcpy(line1+8,buff ,5);
|
|
memcpy(line1+8,buff ,5);
|
|
- print_chars2(1,20);
|
|
|
|
|
|
+ print_line(1,20);
|
|
}
|
|
}
|
|
break;
|
|
break;
|
|
case (true):
|
|
case (true):
|
|
@@ -1333,7 +1263,7 @@ void transientLoadToggle(){
|
|
transientSwitch(HighCurrent, true);
|
|
transientSwitch(HighCurrent, true);
|
|
dtostrf(HighCurrent, 4, 3, buff);
|
|
dtostrf(HighCurrent, 4, 3, buff);
|
|
memcpy(line1+8,buff ,5);
|
|
memcpy(line1+8,buff ,5);
|
|
- print_chars2(1,20);
|
|
|
|
|
|
+ print_line(1,20);
|
|
}
|
|
}
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
@@ -1342,7 +1272,7 @@ void transientLoadToggle(){
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
- if(Mode == MODE_TP){
|
|
|
|
|
|
+ if(Mode == MODE_TP && Load == 1){
|
|
current_time = micros(); //get the current time in micro seconds()
|
|
current_time = micros(); //get the current time in micro seconds()
|
|
memcpy(line1,"Set I = A",20);
|
|
memcpy(line1,"Set I = A",20);
|
|
if (last_time == 0){
|
|
if (last_time == 0){
|
|
@@ -1351,29 +1281,29 @@ void transientLoadToggle(){
|
|
dtostrf(LowCurrent, 4, 3, buff);
|
|
dtostrf(LowCurrent, 4, 3, buff);
|
|
memcpy(line1+8,buff ,5);
|
|
memcpy(line1+8,buff ,5);
|
|
}
|
|
}
|
|
- if (digitalRead(TriggerPulse) == LOW || trig_key){
|
|
|
|
|
|
+ if (digitalRead(TRIGGERPULSE_PIN) == LOW || trig_key){
|
|
// a trigger pluse is received
|
|
// a trigger pluse is received
|
|
// set to the high current
|
|
// set to the high current
|
|
trig_key=false;
|
|
trig_key=false;
|
|
transientSwitch(HighCurrent, true);
|
|
transientSwitch(HighCurrent, true);
|
|
dtostrf(HighCurrent, 4, 3, buff);
|
|
dtostrf(HighCurrent, 4, 3, buff);
|
|
memcpy(line1+8,buff ,5);
|
|
memcpy(line1+8,buff ,5);
|
|
- print_chars2(1,20);
|
|
|
|
|
|
+ print_line(1,20);
|
|
} else {
|
|
} else {
|
|
if ((current_time - last_time) >= (transientPeriod * 1000.0)){
|
|
if ((current_time - last_time) >= (transientPeriod * 1000.0)){
|
|
transientSwitch(LowCurrent, true);
|
|
transientSwitch(LowCurrent, true);
|
|
dtostrf(LowCurrent, 4, 3, buff);
|
|
dtostrf(LowCurrent, 4, 3, buff);
|
|
memcpy(line1+8,buff ,5);
|
|
memcpy(line1+8,buff ,5);
|
|
- print_chars2(1,20);
|
|
|
|
|
|
+ print_line(1,20);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
- if(Mode == MODE_TT){ // this function will toggle between high and low current when the trigger pin is taken low
|
|
|
|
|
|
+ if(Mode == MODE_TT && Load == 1){ // this function will toggle between high and low current when the trigger pin is taken low
|
|
|
|
|
|
- if (digitalRead(TriggerPulse) == LOW || trig_key){
|
|
|
|
|
|
+ if (digitalRead(TRIGGERPULSE_PIN) == LOW || trig_key){
|
|
memcpy(line1,"Set I = A",20);
|
|
memcpy(line1,"Set I = A",20);
|
|
trig_key=false;
|
|
trig_key=false;
|
|
switch (transient_mode_status){
|
|
switch (transient_mode_status){
|
|
@@ -1381,16 +1311,16 @@ void transientLoadToggle(){
|
|
transientSwitch(LowCurrent, true);
|
|
transientSwitch(LowCurrent, true);
|
|
dtostrf(LowCurrent, 4, 3, buff);
|
|
dtostrf(LowCurrent, 4, 3, buff);
|
|
memcpy(line1+8,buff ,5);
|
|
memcpy(line1+8,buff ,5);
|
|
- delay(200); //added to prevent key bounce when transient button used (date of addition 31-03-2018)
|
|
|
|
|
|
+ delay(DEBOUNCE_DELAY); //added to prevent key bounce when transient button used (date of addition 31-03-2018)
|
|
break;
|
|
break;
|
|
case (true):
|
|
case (true):
|
|
transientSwitch(HighCurrent, true);
|
|
transientSwitch(HighCurrent, true);
|
|
dtostrf(HighCurrent, 4, 3, buff);
|
|
dtostrf(HighCurrent, 4, 3, buff);
|
|
memcpy(line1+8,buff ,5);
|
|
memcpy(line1+8,buff ,5);
|
|
- delay(200); //added to prevent key bounce when transient button used (date of addition 31-03-2018)
|
|
|
|
|
|
+ delay(DEBOUNCE_DELAY); //added to prevent key bounce when transient button used (date of addition 31-03-2018)
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
- print_chars2(1,20);
|
|
|
|
|
|
+ print_line(1,20);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -1438,13 +1368,13 @@ void userSetUp (void) {
|
|
writeNum2("t3.xcen",(int) 0);
|
|
writeNum2("t3.xcen",(int) 0);
|
|
|
|
|
|
memcpy(line0,"User Set-Up ",21);
|
|
memcpy(line0,"User Set-Up ",21);
|
|
- print_chars2(0,20);
|
|
|
|
|
|
+ print_line(0,20);
|
|
memset(line2,' ',20);
|
|
memset(line2,' ',20);
|
|
- print_chars2(2,20);
|
|
|
|
|
|
+ print_line(2,20);
|
|
memset(line3,' ',20);
|
|
memset(line3,' ',20);
|
|
- print_chars2(3,20);
|
|
|
|
|
|
+ print_line(3,20);
|
|
memcpy(line1,"Current Limit= A",21);
|
|
memcpy(line1,"Current Limit= A",21);
|
|
- print_chars2(1,20);
|
|
|
|
|
|
+ print_line(1,20);
|
|
|
|
|
|
inputValue(1);
|
|
inputValue(1);
|
|
CurrentCutOff = x;
|
|
CurrentCutOff = x;
|
|
@@ -1453,7 +1383,7 @@ void userSetUp (void) {
|
|
customKey=NO_KEY;
|
|
customKey=NO_KEY;
|
|
z = 15;
|
|
z = 15;
|
|
memcpy(line2,"Power Limit = W",21);
|
|
memcpy(line2,"Power Limit = W",21);
|
|
- print_chars2(2,20);
|
|
|
|
|
|
+ print_line(2,20);
|
|
inputValue(2);
|
|
inputValue(2);
|
|
PowerCutOff = x;
|
|
PowerCutOff = x;
|
|
EEPROM.write(0x20, PowerCutOff);
|
|
EEPROM.write(0x20, PowerCutOff);
|
|
@@ -1462,7 +1392,7 @@ void userSetUp (void) {
|
|
z = 15;
|
|
z = 15;
|
|
line3[18]=0xB0;
|
|
line3[18]=0xB0;
|
|
memcpy(line3,"Temp. Limit = C",21);
|
|
memcpy(line3,"Temp. Limit = C",21);
|
|
- print_chars2(3,20);
|
|
|
|
|
|
+ print_line(3,20);
|
|
inputValue(3);
|
|
inputValue(3);
|
|
z = 1;
|
|
z = 1;
|
|
tempCutOff = x;
|
|
tempCutOff = x;
|
|
@@ -1483,7 +1413,7 @@ void temperatureCutOff (void){
|
|
reading = 0;
|
|
reading = 0;
|
|
encoderPosition = 0;
|
|
encoderPosition = 0;
|
|
memcpy(line3,"Over Temperature ",20);
|
|
memcpy(line3,"Over Temperature ",20);
|
|
- print_chars2(3,20);
|
|
|
|
|
|
+ print_line(3,20);
|
|
color_load(0);
|
|
color_load(0);
|
|
toggle = false; //switch Load Off
|
|
toggle = false; //switch Load Off
|
|
}
|
|
}
|
|
@@ -1527,7 +1457,7 @@ void setupLimits (void){
|
|
writeNum2("t2.xcen",(int) 0);
|
|
writeNum2("t2.xcen",(int) 0);
|
|
writeNum2("t3.xcen",(int) 0);
|
|
writeNum2("t3.xcen",(int) 0);
|
|
memcpy(line0," Maximum Limits Set ",20);
|
|
memcpy(line0," Maximum Limits Set ",20);
|
|
- print_chars2(0,20);
|
|
|
|
|
|
+ print_line(0,20);
|
|
char snum[5];
|
|
char snum[5];
|
|
memcpy(line1,"Current Limit= A ",20);
|
|
memcpy(line1,"Current Limit= A ",20);
|
|
CurrentCutOff = EEPROM.read(0x00);
|
|
CurrentCutOff = EEPROM.read(0x00);
|
|
@@ -1535,21 +1465,21 @@ void setupLimits (void){
|
|
|
|
|
|
itoa(CurrentCutOff, snum, 10);
|
|
itoa(CurrentCutOff, snum, 10);
|
|
memcpy(line1+15,snum,length);
|
|
memcpy(line1+15,snum,length);
|
|
- print_chars2(1,20);
|
|
|
|
|
|
+ print_line(1,20);
|
|
|
|
|
|
memcpy(line2,"Power Limit = W ",20);
|
|
memcpy(line2,"Power Limit = W ",20);
|
|
PowerCutOff = EEPROM.read(0x20);
|
|
PowerCutOff = EEPROM.read(0x20);
|
|
length = snprintf( NULL, 0, "%d", PowerCutOff );
|
|
length = snprintf( NULL, 0, "%d", PowerCutOff );
|
|
itoa(PowerCutOff, snum, 10);
|
|
itoa(PowerCutOff, snum, 10);
|
|
memcpy(line2+15,snum,length);
|
|
memcpy(line2+15,snum,length);
|
|
- print_chars2(2,20);
|
|
|
|
|
|
+ print_line(2,20);
|
|
|
|
|
|
memcpy(line3,"Temp. Limit = C ",20);
|
|
memcpy(line3,"Temp. Limit = C ",20);
|
|
tempCutOff = EEPROM.read(0x40);
|
|
tempCutOff = EEPROM.read(0x40);
|
|
length = snprintf( NULL, 0, "%d", tempCutOff );
|
|
length = snprintf( NULL, 0, "%d", tempCutOff );
|
|
itoa(tempCutOff, snum, 10);
|
|
itoa(tempCutOff, snum, 10);
|
|
memcpy(line3+15,snum,length);
|
|
memcpy(line3+15,snum,length);
|
|
- print_chars2(3,20);
|
|
|
|
|
|
+ print_line(3,20);
|
|
|
|
|
|
|
|
|
|
}
|
|
}
|