Post by diesel on Oct 24, 2014 16:44:06 GMT -8
I have a program that when I have 12 buttons on the screen, it will not load.
11 buttons is fine, it loads as expected. If I disable any one button I can put another anywhere I choose.
Is it me or my program, or is something in the C file, keeping me from being able to add more buttons.
What seems strange is, I can press the buttons and command another button to be displayed over the one I pressed. It works fine this way, and I have the ability to display 11 more on top of the others.
if (injector_test) {
Gradient();
input();
GD.cmd_fgcolor(0x303030);
GD.cmd_gradcolor(0x000000);
GD.cmd_button(15, 105, 450, 40, 27, 0, "");//x, y, l, h, font size, text
GD.cmd_button(155, 155, 170, 60, 27, 0, "");//x, y, l, h, font size, text
//GD.cmd_button(105, 225, 47, 40, 29, 0, "");
---------------------------------With this included the program will not load??? Plus I need 2 more buttons as well.
//_____________________________________________________
GD.ColorRGB(0xFFFFFF);
GD.cmd_fgcolor(0xE00000);
GD.cmd_gradcolor(0x000000);
GD.cmd_button(15, 10, 105, 60, 27, 0, "1600/1700");//x, y, l, h, font size, text
GD.cmd_button(130, 10, 105, 60, 27, 0, "1000/160");//x, y, l, h, font size, text
GD.cmd_button(245, 10, 105, 60, 27, 0, "600/800");//x, y, l, h, font size, text
GD.cmd_button(360, 10, 105, 60, 27, 0, "250/700");//x, y, l, h, font size, text
GD.cmd_button(15, 225, 85, 40, 29, 0, "- P +");
GD.cmd_button(157, 225, 85, 40, 29, 0, "- I +");
GD.cmd_button(299, 225, 85, 40, 29, 0, "- D +");
GD.cmd_button(335, 155, 130, 60, 29, 0, "PLOT Set");//x, y, l, h, font size, text
if (select_i) {
if ((x1 >= 15) && (x1 <= 120) && (y1 >= 10) && (y1 <= 70)) { //x, y, l, h,
test_1 = true;
test_2 = false;
test_3 = false;
test_4 = false;
setpoint = 1610;
P = 2.5;
I = 1.5;
D = 1;
pw = 1700;
pc = 600;
}
//___________________________________________________________
if ((x1 >= 130) && (x1 <= 235) && (y1 >= 10) && (y1 <= 70)) { //x, y, l, h,
test_2 = true;
test_1 = false;
test_3 = false;
test_4 = false;
setpoint = 1000;
P = 7.5;
I = 1.2;
D = .2;
pw = 160;
pc = 600;
}
//___________________________________________________________
if ((x1 >= 245) && (x1 <= 350) && (y1 >= 10) && (y1 <= 70)) { //x, y, l, h,
test_3 = true;
test_1 = false;
test_2 = false;
test_4 = false;
setpoint = 600;
P = 10;
I = 1;
D = 1;
pw = 700;
pc = 600;
}
//___________________________________________________________
if ((x1 >= 360) && (x1 <= 465) && (y1 >= 10) && (y1 <= 70)) { //x, y, l, h,
test_4 = true;
test_1 = false;
test_2 = false;
test_3 = false;
setpoint = 250;
P = 10;
I = 1;
D = 1;
pw = 800;
pc = 600;
}
}
if (test_1) {
GD.ColorRGB(0, 255, 0);
GD.cmd_fgcolor(0x303030);
GD.cmd_gradcolor(0x000000);
GD.cmd_button(20, 17, 94, 45, 29, 0, "Test 1");//x, y, l, h, font size, text
}
if (test_2) {
GD.ColorRGB(0, 255, 0);
GD.cmd_fgcolor(0x303030);
GD.cmd_gradcolor(0x000000);
GD.cmd_button(135, 17, 94, 45, 29, 0, "Test 2");//x, y, l, h, font size, text
}
if (test_3) {
GD.ColorRGB(0, 255, 0);
GD.cmd_fgcolor(0x303030);
GD.cmd_gradcolor(0x000000);
GD.cmd_button(250, 17, 94, 45, 29, 0, "Test 3");//x, y, l, h, font size, text
}
if (test_4) {
GD.ColorRGB(0, 255, 0);
GD.cmd_fgcolor(0x303030);
GD.cmd_gradcolor(0x000000);
GD.cmd_button(365, 17, 94, 45, 29, 0, "Test 4");//x, y, l, h, font size, text
}
//_________________________________________________________
if ((x1 >= 15) && (x1 <= 55) && (y1 >= 225) && (y1 <= 265)) { //x, y, l, h, P
GD.ColorRGB(0, 255, 0);
GD.cmd_fgcolor(0x303030);
GD.cmd_gradcolor(0x000000);
GD.cmd_button(47, 228, 50, 34, 30, 0, "-");
unsigned long PressDelay2 = millis();
if (PressDelay2 - PressTime > PD_2) {
PressTime = PressDelay2;
P -= .1;
}
}
if ((x1 >= 60) && (x1 <= 100) && (y1 >= 225) && (y1 <= 265)) { //x, y, l, h, P
GD.ColorRGB(0, 255, 0);
GD.cmd_fgcolor(0x303030);
GD.cmd_gradcolor(0x000000);
GD.cmd_button(18, 228, 50, 34, 30, 0, "+");
unsigned long PressDelay2 = millis();
if (PressDelay2 - PressTime > PD_2) {
PressTime = PressDelay2;
P += .1;
}
}
if ((x1 >= 157) && (x1 <= 197) && (y1 >= 225) && (y1 <= 265)) { //x, y, l, h, I
GD.ColorRGB(0, 255, 0);
GD.cmd_fgcolor(0x303030);
GD.cmd_gradcolor(0x000000);
GD.cmd_button(189, 228, 50, 34, 30, 0, "-");
unsigned long PressDelay2 = millis();
if (PressDelay2 - PressTime > PD_2) {
PressTime = PressDelay2;
I -= .1;
}
}
if ((x1 >= 203) && (x1 <= 243) && (y1 >= 225) && (y1 <= 265)) { //x, y, l, h, I
GD.ColorRGB(0, 255, 0);
GD.cmd_fgcolor(0x303030);
GD.cmd_gradcolor(0x000000);
GD.cmd_button(160, 228, 50, 34, 30, 0, "+");
unsigned long PressDelay2 = millis();
if (PressDelay2 - PressTime > PD_2) {
PressTime = PressDelay2;
I += .1;
}
}
if ((x1 >= 299) && (x1 <= 339) && (y1 >= 225) && (y1 <= 265)) { //x, y, l, h, D
GD.ColorRGB(0, 255, 0);
GD.cmd_fgcolor(0x303030);
GD.cmd_gradcolor(0x000000);
GD.cmd_button(331, 228, 50, 34, 30, 0, "-");
unsigned long PressDelay2 = millis();
if (PressDelay2 - PressTime > PD_2) {
PressTime = PressDelay2;
D -= .1;
}
}
if ((x1 >= 344) && (x1 <= 384) && (y1 >= 225) && (y1 <= 265)) { //x, y, l, h, D
GD.ColorRGB(0, 255, 0);
GD.cmd_fgcolor(0x303030);
GD.cmd_gradcolor(0x000000);
GD.cmd_button(302, 228, 50, 34, 30, 0, "+");
unsigned long PressDelay2 = millis();
if (PressDelay2 - PressTime > PD_2) {
PressTime = PressDelay2;
D += .1;
}
}
GD.ColorRGB(0, 255, 0);
GD.cmd_number(127, 245, 30, OPT_CENTER | 2, P*10);
GD.cmd_number(269, 245, 30, OPT_CENTER | 2, I*10);
GD.cmd_number(408, 245, 30, OPT_CENTER | 2, D*10);
P = constrain(P, 0, 99);
I = constrain(I, 0, 99);
D = constrain(D, 0, 99);
//_________________________________________________________
GD.ColorRGB(255, 255, 255);
GD.cmd_fgcolor(0x009000);
GD.cmd_gradcolor(0x000000);
GD.cmd_button(15, 155, 130, 60, 29, 0, "Start Test");
if ((x1 >= 15) && (x1 <= 145) && (y1 >= 155) && (y1 <= 215)) { //x, y, l, h,
set_pressure = true;
inj_start = false;
pressure_set = false;
select_i = false;
Drive = 60000;
}
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++
if (set_pressure) {
Drive -= 25;
value4 = 99 - Drive * .00154;
GD.ColorRGB(255, 0, 0);
GD.cmd_number(275, 125, 30, OPT_CENTER | 2, value4);
GD.ColorRGB(255, 255, 255);
start_test = true;
average_fast();
pwmWriteHR(mprop, Drive);
if (Average_two > setpoint) {
Integ = Drive;
pressure_set = true;
Run = true;
set_pressure = false;
}
}
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++
if (Run) {
if (pressure_set == true) {
inj_start = true;
select_i = false;
Run = false;
}
}
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++
if (start_test) {
GD.cmd_fgcolor(0x303030);
GD.ColorRGB(255, 0, 0);
GD.cmd_gradcolor(0x000000);
GD.cmd_button(20, 162, 119, 45, 29, 0, "TESTING");
}
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++
if ((x1 >= 335) && (x1 <= 465) && (y1 >= 155) && (y1 <= 215)) { //x, y, l, h,//PLOT Set
pressed6 = OPT_FLAT;
//load_set =true;
}
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++
if (ps == 2) {
UDpulsespeed = 100;
}
//_________________________
GD.ColorRGB(0, 0, 0);
GD.cmd_text(239, 86, 27, OPT_CENTER, "Bar / uS Select Test 1 - 4 Then Press Start Test");
GD.ColorRGB(0, 255, 0);
GD.cmd_text(240, 87, 27, OPT_CENTER, "Bar / uS Select Test 1 - 4 Then Press Start Test");
//______________________________________________________________________________
GD.ColorRGB(0, 0, 0);
GD.cmd_text(199, 184, 29, OPT_CENTER, "Bar");
GD.cmd_text(44, 124, 27, OPT_CENTER, "Pulse");
GD.cmd_text(209, 124, 27, OPT_CENTER, "Control");
GD.cmd_text(359, 124, 27, OPT_CENTER, "Temp");
GD.ColorRGB(255, 255, 255);
GD.cmd_text(200, 185, 29, OPT_CENTER, "Bar");
GD.cmd_text(45, 125, 27, OPT_CENTER, "Pulse");
GD.cmd_text(210, 125, 27, OPT_CENTER, "Control");
GD.cmd_text(360, 125, 27, OPT_CENTER, "Temp");
average();
GD.ColorRGB(0, 255, 0);
GD.cmd_number(265, 185, 30, OPT_CENTER | 4, Average);
//GD.cmd_number(400, 245, 30, OPT_CENTER | 2, steinhart);
ret();
}
11 buttons is fine, it loads as expected. If I disable any one button I can put another anywhere I choose.
Is it me or my program, or is something in the C file, keeping me from being able to add more buttons.
What seems strange is, I can press the buttons and command another button to be displayed over the one I pressed. It works fine this way, and I have the ability to display 11 more on top of the others.
if (injector_test) {
Gradient();
input();
GD.cmd_fgcolor(0x303030);
GD.cmd_gradcolor(0x000000);
GD.cmd_button(15, 105, 450, 40, 27, 0, "");//x, y, l, h, font size, text
GD.cmd_button(155, 155, 170, 60, 27, 0, "");//x, y, l, h, font size, text
//GD.cmd_button(105, 225, 47, 40, 29, 0, "");
---------------------------------With this included the program will not load??? Plus I need 2 more buttons as well.
//_____________________________________________________
GD.ColorRGB(0xFFFFFF);
GD.cmd_fgcolor(0xE00000);
GD.cmd_gradcolor(0x000000);
GD.cmd_button(15, 10, 105, 60, 27, 0, "1600/1700");//x, y, l, h, font size, text
GD.cmd_button(130, 10, 105, 60, 27, 0, "1000/160");//x, y, l, h, font size, text
GD.cmd_button(245, 10, 105, 60, 27, 0, "600/800");//x, y, l, h, font size, text
GD.cmd_button(360, 10, 105, 60, 27, 0, "250/700");//x, y, l, h, font size, text
GD.cmd_button(15, 225, 85, 40, 29, 0, "- P +");
GD.cmd_button(157, 225, 85, 40, 29, 0, "- I +");
GD.cmd_button(299, 225, 85, 40, 29, 0, "- D +");
GD.cmd_button(335, 155, 130, 60, 29, 0, "PLOT Set");//x, y, l, h, font size, text
if (select_i) {
if ((x1 >= 15) && (x1 <= 120) && (y1 >= 10) && (y1 <= 70)) { //x, y, l, h,
test_1 = true;
test_2 = false;
test_3 = false;
test_4 = false;
setpoint = 1610;
P = 2.5;
I = 1.5;
D = 1;
pw = 1700;
pc = 600;
}
//___________________________________________________________
if ((x1 >= 130) && (x1 <= 235) && (y1 >= 10) && (y1 <= 70)) { //x, y, l, h,
test_2 = true;
test_1 = false;
test_3 = false;
test_4 = false;
setpoint = 1000;
P = 7.5;
I = 1.2;
D = .2;
pw = 160;
pc = 600;
}
//___________________________________________________________
if ((x1 >= 245) && (x1 <= 350) && (y1 >= 10) && (y1 <= 70)) { //x, y, l, h,
test_3 = true;
test_1 = false;
test_2 = false;
test_4 = false;
setpoint = 600;
P = 10;
I = 1;
D = 1;
pw = 700;
pc = 600;
}
//___________________________________________________________
if ((x1 >= 360) && (x1 <= 465) && (y1 >= 10) && (y1 <= 70)) { //x, y, l, h,
test_4 = true;
test_1 = false;
test_2 = false;
test_3 = false;
setpoint = 250;
P = 10;
I = 1;
D = 1;
pw = 800;
pc = 600;
}
}
if (test_1) {
GD.ColorRGB(0, 255, 0);
GD.cmd_fgcolor(0x303030);
GD.cmd_gradcolor(0x000000);
GD.cmd_button(20, 17, 94, 45, 29, 0, "Test 1");//x, y, l, h, font size, text
}
if (test_2) {
GD.ColorRGB(0, 255, 0);
GD.cmd_fgcolor(0x303030);
GD.cmd_gradcolor(0x000000);
GD.cmd_button(135, 17, 94, 45, 29, 0, "Test 2");//x, y, l, h, font size, text
}
if (test_3) {
GD.ColorRGB(0, 255, 0);
GD.cmd_fgcolor(0x303030);
GD.cmd_gradcolor(0x000000);
GD.cmd_button(250, 17, 94, 45, 29, 0, "Test 3");//x, y, l, h, font size, text
}
if (test_4) {
GD.ColorRGB(0, 255, 0);
GD.cmd_fgcolor(0x303030);
GD.cmd_gradcolor(0x000000);
GD.cmd_button(365, 17, 94, 45, 29, 0, "Test 4");//x, y, l, h, font size, text
}
//_________________________________________________________
if ((x1 >= 15) && (x1 <= 55) && (y1 >= 225) && (y1 <= 265)) { //x, y, l, h, P
GD.ColorRGB(0, 255, 0);
GD.cmd_fgcolor(0x303030);
GD.cmd_gradcolor(0x000000);
GD.cmd_button(47, 228, 50, 34, 30, 0, "-");
unsigned long PressDelay2 = millis();
if (PressDelay2 - PressTime > PD_2) {
PressTime = PressDelay2;
P -= .1;
}
}
if ((x1 >= 60) && (x1 <= 100) && (y1 >= 225) && (y1 <= 265)) { //x, y, l, h, P
GD.ColorRGB(0, 255, 0);
GD.cmd_fgcolor(0x303030);
GD.cmd_gradcolor(0x000000);
GD.cmd_button(18, 228, 50, 34, 30, 0, "+");
unsigned long PressDelay2 = millis();
if (PressDelay2 - PressTime > PD_2) {
PressTime = PressDelay2;
P += .1;
}
}
if ((x1 >= 157) && (x1 <= 197) && (y1 >= 225) && (y1 <= 265)) { //x, y, l, h, I
GD.ColorRGB(0, 255, 0);
GD.cmd_fgcolor(0x303030);
GD.cmd_gradcolor(0x000000);
GD.cmd_button(189, 228, 50, 34, 30, 0, "-");
unsigned long PressDelay2 = millis();
if (PressDelay2 - PressTime > PD_2) {
PressTime = PressDelay2;
I -= .1;
}
}
if ((x1 >= 203) && (x1 <= 243) && (y1 >= 225) && (y1 <= 265)) { //x, y, l, h, I
GD.ColorRGB(0, 255, 0);
GD.cmd_fgcolor(0x303030);
GD.cmd_gradcolor(0x000000);
GD.cmd_button(160, 228, 50, 34, 30, 0, "+");
unsigned long PressDelay2 = millis();
if (PressDelay2 - PressTime > PD_2) {
PressTime = PressDelay2;
I += .1;
}
}
if ((x1 >= 299) && (x1 <= 339) && (y1 >= 225) && (y1 <= 265)) { //x, y, l, h, D
GD.ColorRGB(0, 255, 0);
GD.cmd_fgcolor(0x303030);
GD.cmd_gradcolor(0x000000);
GD.cmd_button(331, 228, 50, 34, 30, 0, "-");
unsigned long PressDelay2 = millis();
if (PressDelay2 - PressTime > PD_2) {
PressTime = PressDelay2;
D -= .1;
}
}
if ((x1 >= 344) && (x1 <= 384) && (y1 >= 225) && (y1 <= 265)) { //x, y, l, h, D
GD.ColorRGB(0, 255, 0);
GD.cmd_fgcolor(0x303030);
GD.cmd_gradcolor(0x000000);
GD.cmd_button(302, 228, 50, 34, 30, 0, "+");
unsigned long PressDelay2 = millis();
if (PressDelay2 - PressTime > PD_2) {
PressTime = PressDelay2;
D += .1;
}
}
GD.ColorRGB(0, 255, 0);
GD.cmd_number(127, 245, 30, OPT_CENTER | 2, P*10);
GD.cmd_number(269, 245, 30, OPT_CENTER | 2, I*10);
GD.cmd_number(408, 245, 30, OPT_CENTER | 2, D*10);
P = constrain(P, 0, 99);
I = constrain(I, 0, 99);
D = constrain(D, 0, 99);
//_________________________________________________________
GD.ColorRGB(255, 255, 255);
GD.cmd_fgcolor(0x009000);
GD.cmd_gradcolor(0x000000);
GD.cmd_button(15, 155, 130, 60, 29, 0, "Start Test");
if ((x1 >= 15) && (x1 <= 145) && (y1 >= 155) && (y1 <= 215)) { //x, y, l, h,
set_pressure = true;
inj_start = false;
pressure_set = false;
select_i = false;
Drive = 60000;
}
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++
if (set_pressure) {
Drive -= 25;
value4 = 99 - Drive * .00154;
GD.ColorRGB(255, 0, 0);
GD.cmd_number(275, 125, 30, OPT_CENTER | 2, value4);
GD.ColorRGB(255, 255, 255);
start_test = true;
average_fast();
pwmWriteHR(mprop, Drive);
if (Average_two > setpoint) {
Integ = Drive;
pressure_set = true;
Run = true;
set_pressure = false;
}
}
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++
if (Run) {
if (pressure_set == true) {
inj_start = true;
select_i = false;
Run = false;
}
}
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++
if (start_test) {
GD.cmd_fgcolor(0x303030);
GD.ColorRGB(255, 0, 0);
GD.cmd_gradcolor(0x000000);
GD.cmd_button(20, 162, 119, 45, 29, 0, "TESTING");
}
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++
if ((x1 >= 335) && (x1 <= 465) && (y1 >= 155) && (y1 <= 215)) { //x, y, l, h,//PLOT Set
pressed6 = OPT_FLAT;
//load_set =true;
}
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++
if (ps == 2) {
UDpulsespeed = 100;
}
//_________________________
GD.ColorRGB(0, 0, 0);
GD.cmd_text(239, 86, 27, OPT_CENTER, "Bar / uS Select Test 1 - 4 Then Press Start Test");
GD.ColorRGB(0, 255, 0);
GD.cmd_text(240, 87, 27, OPT_CENTER, "Bar / uS Select Test 1 - 4 Then Press Start Test");
//______________________________________________________________________________
GD.ColorRGB(0, 0, 0);
GD.cmd_text(199, 184, 29, OPT_CENTER, "Bar");
GD.cmd_text(44, 124, 27, OPT_CENTER, "Pulse");
GD.cmd_text(209, 124, 27, OPT_CENTER, "Control");
GD.cmd_text(359, 124, 27, OPT_CENTER, "Temp");
GD.ColorRGB(255, 255, 255);
GD.cmd_text(200, 185, 29, OPT_CENTER, "Bar");
GD.cmd_text(45, 125, 27, OPT_CENTER, "Pulse");
GD.cmd_text(210, 125, 27, OPT_CENTER, "Control");
GD.cmd_text(360, 125, 27, OPT_CENTER, "Temp");
average();
GD.ColorRGB(0, 255, 0);
GD.cmd_number(265, 185, 30, OPT_CENTER | 4, Average);
//GD.cmd_number(400, 245, 30, OPT_CENTER | 2, steinhart);
ret();
}