Re: 18650 Conditioner unit.
Posted: Tue May 07, 2019 8:47 am
Be more than happy to ... this will be a long post as I will drop 2 versions of code to show the problem, feel free to delete this post later if you like. or shorten it. OK where to start... look at this line:-
Serial.print("Power: "); Serial.print(power_mW); Serial.print("mW ");
................... ^^^^^^^ This bit is fixed ^^^^^^^^^^ this bit takes a variable OK .
Problem is when you have multiples of the word POWER to send to the table, the table code writes and overwrites that line in a table.
Now I show a bit more to help explain.
--------------------------------------------------------------------------------------------------------------------------------------------------
int ina; int t; int ct; int pin; // initialize variables used in loop.
for (t=3; t<8; t++){//2
tcaselect(t);
for (ina=0; ina<4; ina++) // initialize the 219s
{//3
ct++;Serial.print(" Bay-");Serial.print(ct); pin=(21+ct);
ina219[ina].begin();
float shuntvoltage = 0; //initialize variables
float busvoltage = 0;
float current_mA = 0;
float loadvoltage = 0;
float power_mW = 0;
shuntvoltage = ina219[ina].getShuntVoltage_mV(); // read INA219 info into variables
busvoltage = ina219[ina].getBusVoltage_V();
current_mA = ina219[ina].getCurrent_mA();
power_mW = ina219[ina].getPower_mW();
loadvoltage = busvoltage + (shuntvoltage / 1000);
Serial.print(""); // write each INA219 info on the screen.
Serial.print("Bus: "); Serial.print(busvoltage); Serial.print("V ");
Serial.print("Shunt: "); Serial.print(shuntvoltage); Serial.print("mV ");
Serial.print("Current: "); Serial.print(current_mA); Serial.print("mA ");
Serial.print("Power: "); Serial.print(power_mW); Serial.print("mW ");
}//3
}//2
----------------------------------------------------------------------------------------------------------------------------------------------------------------------
Originally when I wrote this code, its made up of 2 loops. One outside loop steps through 5 channels on a I2C multiplexer. The second loop reads the 4 sensors on each channel. easier to show like this:-
channel 1 sensors 1,2,3,4
chennel 2 sensors 1,2,3,4
and so on for 5 channels so in all 5x4 sensor are read. 20 sensors, add into the mix EACH sensor gives 4 readings of data. Means we are dealing with 80 readings of data in total , just on this section.
Now because this:-
Serial.print("Power: "); Serial.print(power_mW); Serial.print("mW ");
.................. ^^^^^^^ is "fixed" EG I cannot use a string here, this creates a problem.
If it was coded like this:-
Serial.print("$Power: "); Serial.print(power_mW); Serial.print("mW ");
Telling the code that $power is a string variable , then we could do this:-
}
if (a < 20): a++;
$power = (Cell(a) Power);
Serial.print("$Power: "); Serial.print(power_mW); Serial.print("mW ");
}
the $Power variable now contains "Cell1 Power" next time round reads "Cell2 Power" and so on.
By allowing us to manipulate the NAME it stops us having to write the data out in what I call " Long Hand".
Beacause MLP locks the NAME into entered text only, and does not allow a string to sit in its place this is what I had to write to by-pass that problem:-
(note code is upgraded from screen writes to table write, but principle still applies.
int ct; // initialize variables used inside loop.
{//2
ct=0;
//--------------------------------------------------------------------
ct++; Serial.print(" Bay-"); Serial.print(ct);
CellTest(3,0);
Table Block1("Block1");
Block1.SendData(F("Cell-1"), ct, "Status");
Block1.SendData(F("Cell-1 Bus: "), busvoltage, "V");
Block1.SendData(F("Cell-1 Shunt: "), shuntvoltage, "mV");
Block1.SendData(F("Cell-1 Current: "), current_mA, "mA");
Block1.SendData(F("Cell-1 Power: "), power_mW, "mW");
//--------------------------------------------------------------------
ct++; Serial.print(" Bay-"); Serial.print(ct);
CellTest(3,1);
Block1.SendData(F("Cell-2"), ct, "Status");
Block1.SendData(F("Cell-2 Bus: "), busvoltage, "V");
Block1.SendData(F("Cell-2 Shunt: "), shuntvoltage, "mV");
Block1.SendData(F("Cell-2 Current: "), current_mA, "mA");
Block1.SendData(F("Cell-2 Power: "), power_mW, "mW");
//--------------------------------------------------------------------
ct++; Serial.print(" Bay-"); Serial.print(ct);
CellTest(3,2);
Block1.SendData(F("Cell-3"), ct, "Status");
Block1.SendData(F("Cell-3 Bus: "), busvoltage, "V");
Block1.SendData(F("Cell-3 Shunt: "), shuntvoltage, "mV");
Block1.SendData(F("Cell-3 Current: "), current_mA, "mA");
Block1.SendData(F("Cell-3 Power: "), power_mW, "mW");
//--------------------------------------------------------------------
ct++; Serial.print(" Bay-"); Serial.print(ct);
CellTest(3,3);
Block1.SendData(F("Cell-4"), ct, "Status");
Block1.SendData(F("Cell-4 Bus: "), busvoltage, "V");
Block1.SendData(F("Cell-4 Shunt: "), shuntvoltage, "mV");
Block1.SendData(F("Cell-4 Current: "), current_mA, "mA");
Block1.SendData(F("Cell-4 Power: "), power_mW, "mW");
//--------------------------------------------------------------------
ct++; Serial.print(" Bay-"); Serial.print(ct);
CellTest(4,0);
Table Block2("Block2");
Block2.SendData(F("Cell-5"), ct, "Status");
Block2.SendData(F("Cell-5 Bus: "), busvoltage, "V");
Block2.SendData(F("Cell-5 Shunt: "), shuntvoltage, "mV");
Block2.SendData(F("Cell-5 Current: "), current_mA, "mA");
Block2.SendData(F("Cell-5 Power: "), power_mW, "mW");
//--------------------------------------------------------------------
ct++; Serial.print(" Bay-"); Serial.print(ct);
CellTest(4,1);
Block2.SendData(F("Cell-6"), ct, "Status");
Block2.SendData(F("Cell-6 Bus: "), busvoltage, "V");
Block2.SendData(F("Cell-6 Shunt: "), shuntvoltage, "mV");
Block2.SendData(F("Cell-6 Current: "), current_mA, "mA");
Block2.SendData(F("Cell-6 Power: "), power_mW, "mW");
//--------------------------------------------------------------------
ct++; Serial.print(" Bay-"); Serial.print(ct);
CellTest(4,2);
Block2.SendData(F("Cell-7"), ct, "Status");
Block2.SendData(F("Cell-7 Bus: "), busvoltage, "V");
Block2.SendData(F("Cell-7 Shunt: "), shuntvoltage, "mV");
Block2.SendData(F("Cell-7 Current: "), current_mA, "mA");
Block2.SendData(F("Cell-7 Power: "), power_mW, "mW");
//--------------------------------------------------------------------
ct++; Serial.print(" Bay-"); Serial.print(ct);
CellTest(4,3);
Block2.SendData(F("Cell-8"), ct, "Status");
Block2.SendData(F("Cell-8 Bus: "), busvoltage, "V");
Block2.SendData(F("Cell-8 Shunt: "), shuntvoltage, "mV");
Block2.SendData(F("Cell-8 Current: "), current_mA, "mA");
Block2.SendData(F("Cell-8 Power: "), power_mW, "mW");
//--------------------------------------------------------------------
ct++; Serial.print(" Bay-"); Serial.print(ct);
CellTest(5, 0);
Table Block3("Block3");
Block3.SendData(F("Cell-9"), ct, "Status");
Block3.SendData(F("Cell-9 Bus: "), busvoltage, "V");
Block3.SendData(F("Cell-9 Shunt: "), shuntvoltage, "mV");
Block3.SendData(F("Cell-9 Current: "), current_mA, "mA");
Block3.SendData(F("Cell-9 Power: "), power_mW, "mW");
//--------------------------------------------------------------------
ct++; Serial.print(" Bay-"); Serial.print(ct);
CellTest(5,1);
Block3.SendData(F("Cell-10"), ct, "Status");
Block3.SendData(F("Cell-10 Bus: "), busvoltage, "V");
Block3.SendData(F("Cell-10 Shunt: "), shuntvoltage, "mV");
Block3.SendData(F("Cell-10 Current: "), current_mA, "mA");
Block3.SendData(F("Cell-10 Power: "), power_mW, "mW");
//--------------------------------------------------------------------
ct++; Serial.print(" Bay-"); Serial.print(ct);
CellTest(5,2);
Block3.SendData(F("Cell-11"), ct, "Status");
Block3.SendData(F("Cell-11 Bus: "), busvoltage, "V");
Block3.SendData(F("Cell-11 Shunt: "), shuntvoltage, "mV");
Block3.SendData(F("Cell-11 Current: "), current_mA, "mA");
Block3.SendData(F("Cell-11 Power: "), power_mW, "mW");
//--------------------------------------------------------------------
ct++; Serial.print(" Bay-"); Serial.print(ct);
CellTest(5,3);
Block3.SendData(F("Cell-12"), ct, "Status");
Block3.SendData(F("Cell-12 Bus: "), busvoltage, "V");
Block3.SendData(F("Cell-12 Shunt: "), shuntvoltage, "mV");
Block3.SendData(F("Cell-12 Current: "), current_mA, "mA");
Block3.SendData(F("Cell-12 Power: "), power_mW, "mW");
//--------------------------------------------------------------------
ct++; Serial.print(" Bay-"); Serial.print(ct);
CellTest(6,0);
Table Block4("Block4");
Block4.SendData(F("Cell-13"), ct, "Status");
Block4.SendData(F("Cell-13 Bus: "), busvoltage, "V");
Block4.SendData(F("Cell-13 Shunt: "), shuntvoltage, "mV");
Block4.SendData(F("Cell-13 Current: "), current_mA, "mA");
Block4.SendData(F("Cell-13 Power: "), power_mW, "mW");
//--------------------------------------------------------------------
ct++; Serial.print(" Bay-"); Serial.print(ct);
CellTest(6,1);
Block4.SendData(F("Cell-14"), ct, "Status");
Block4.SendData(F("Cell-14 Bus: "), busvoltage, "V");
Block4.SendData(F("Cell-14 Shunt: "), shuntvoltage, "mV");
Block4.SendData(F("Cell-14 Current: "), current_mA, "mA");
Block4.SendData(F("Cell-14 Power: "), power_mW, "mW");
//--------------------------------------------------------------------
ct++; Serial.print(" Bay-"); Serial.print(ct);
CellTest(6,2);
Block4.SendData(F("Cell-15"), ct, "Status");
Block4.SendData(F("Cell-15 Bus: "), busvoltage, "V");
Block4.SendData(F("Cell-15 Shunt: "), shuntvoltage, "mV");
Block4.SendData(F("Cell-15 Current: "), current_mA, "mA");
Block4.SendData(F("Cell-15 Power: "), power_mW, "mW");
//--------------------------------------------------------------------
ct++; Serial.print(" Bay-"); Serial.print(ct);
CellTest(6,3);
Block4.SendData(F("Cell-16"), ct, "Status");
Block4.SendData(F("Cell-16 Bus: "), busvoltage, "V");
Block4.SendData(F("Cell-16 Shunt: "), shuntvoltage, "mV");
Block4.SendData(F("Cell-16 Current: "), current_mA, "mA");
Block4.SendData(F("Cell-16 Power: "), power_mW, "mW");
//--------------------------------------------------------------------
ct++; Serial.print(" Bay-"); Serial.println(ct);
CellTest(7,0);
Table Block5("Block5");
Block5.SendData(F("Cell-17"), ct, "Status");
Block5.SendData(F("Cell-17 Bus: "), busvoltage, "V");
Block5.SendData(F("Cell-17 Shunt: "), shuntvoltage, "mV");
Block5.SendData(F("Cell-17 Current: "), current_mA, "mA");
Block5.SendData(F("Cell-17 Power: "), power_mW, "mW");
//--------------------------------------------------------------------
ct++; Serial.print(" Bay-"); Serial.println(ct);
CellTest(7,1);
Block5.SendData(F("Cell-18"), ct, "Status");
Block5.SendData(F("Cell-18 Bus: "), busvoltage, "V");
Block5.SendData(F("Cell-18 Shunt: "), shuntvoltage, "mV");
Block5.SendData(F("Cell-18 Current: "), current_mA, "mA");
Block5.SendData(F("Cell-18 Power: "), power_mW, "mW");
//--------------------------------------------------------------------
ct++; Serial.print(" Bay-"); Serial.print(ct);
CellTest(7,2);
Block5.SendData(F("Cell-19"), ct, "Status");
Block5.SendData(F("Cell-19 Bus: "), busvoltage, "V");
Block5.SendData(F("Cell-19 Shunt: "), shuntvoltage, "mV");
Block5.SendData(F("Cell-19 Current: "), current_mA, "mA");
Block5.SendData(F("Cell-19 Power: "), power_mW, "mW");
//--------------------------------------------------------------------
ct++; Serial.print(" Bay-"); Serial.println(ct); // this is a debug line
CellTest(7,3);
Block5.SendData(F("Cell-20"), ct, "Status");
Block5.SendData(F("Cell-20 Bus: "), busvoltage, "V");
Block5.SendData(F("Cell-20 Shunt: "), shuntvoltage, "mV");
Block5.SendData(F("Cell-20 Current: "), current_mA, "mA");
Block5.SendData(F("Cell-20 Power: "), power_mW, "mW");
}
As you can see, writing 4 Sensors to 5 tables takes much more repetitive coding to succeed.
Now I know not everyone is crazy like me and builds a large project, but even a smaller project like a area surveillance system with say 10 sensors would benefit from the ability to use a "$string " function like the old basic programming from 30 or more year ago.
I *hope* I have explained it a bit better, again sorry for the long post.
Mike.
Serial.print("Power: "); Serial.print(power_mW); Serial.print("mW ");
................... ^^^^^^^ This bit is fixed ^^^^^^^^^^ this bit takes a variable OK .
Problem is when you have multiples of the word POWER to send to the table, the table code writes and overwrites that line in a table.
Now I show a bit more to help explain.
--------------------------------------------------------------------------------------------------------------------------------------------------
int ina; int t; int ct; int pin; // initialize variables used in loop.
for (t=3; t<8; t++){//2
tcaselect(t);
for (ina=0; ina<4; ina++) // initialize the 219s
{//3
ct++;Serial.print(" Bay-");Serial.print(ct); pin=(21+ct);
ina219[ina].begin();
float shuntvoltage = 0; //initialize variables
float busvoltage = 0;
float current_mA = 0;
float loadvoltage = 0;
float power_mW = 0;
shuntvoltage = ina219[ina].getShuntVoltage_mV(); // read INA219 info into variables
busvoltage = ina219[ina].getBusVoltage_V();
current_mA = ina219[ina].getCurrent_mA();
power_mW = ina219[ina].getPower_mW();
loadvoltage = busvoltage + (shuntvoltage / 1000);
Serial.print(""); // write each INA219 info on the screen.
Serial.print("Bus: "); Serial.print(busvoltage); Serial.print("V ");
Serial.print("Shunt: "); Serial.print(shuntvoltage); Serial.print("mV ");
Serial.print("Current: "); Serial.print(current_mA); Serial.print("mA ");
Serial.print("Power: "); Serial.print(power_mW); Serial.print("mW ");
}//3
}//2
----------------------------------------------------------------------------------------------------------------------------------------------------------------------
Originally when I wrote this code, its made up of 2 loops. One outside loop steps through 5 channels on a I2C multiplexer. The second loop reads the 4 sensors on each channel. easier to show like this:-
channel 1 sensors 1,2,3,4
chennel 2 sensors 1,2,3,4
and so on for 5 channels so in all 5x4 sensor are read. 20 sensors, add into the mix EACH sensor gives 4 readings of data. Means we are dealing with 80 readings of data in total , just on this section.
Now because this:-
Serial.print("Power: "); Serial.print(power_mW); Serial.print("mW ");
.................. ^^^^^^^ is "fixed" EG I cannot use a string here, this creates a problem.
If it was coded like this:-
Serial.print("$Power: "); Serial.print(power_mW); Serial.print("mW ");
Telling the code that $power is a string variable , then we could do this:-
}
if (a < 20): a++;
$power = (Cell(a) Power);
Serial.print("$Power: "); Serial.print(power_mW); Serial.print("mW ");
}
the $Power variable now contains "Cell1 Power" next time round reads "Cell2 Power" and so on.
By allowing us to manipulate the NAME it stops us having to write the data out in what I call " Long Hand".
Beacause MLP locks the NAME into entered text only, and does not allow a string to sit in its place this is what I had to write to by-pass that problem:-
(note code is upgraded from screen writes to table write, but principle still applies.
int ct; // initialize variables used inside loop.
{//2
ct=0;
//--------------------------------------------------------------------
ct++; Serial.print(" Bay-"); Serial.print(ct);
CellTest(3,0);
Table Block1("Block1");
Block1.SendData(F("Cell-1"), ct, "Status");
Block1.SendData(F("Cell-1 Bus: "), busvoltage, "V");
Block1.SendData(F("Cell-1 Shunt: "), shuntvoltage, "mV");
Block1.SendData(F("Cell-1 Current: "), current_mA, "mA");
Block1.SendData(F("Cell-1 Power: "), power_mW, "mW");
//--------------------------------------------------------------------
ct++; Serial.print(" Bay-"); Serial.print(ct);
CellTest(3,1);
Block1.SendData(F("Cell-2"), ct, "Status");
Block1.SendData(F("Cell-2 Bus: "), busvoltage, "V");
Block1.SendData(F("Cell-2 Shunt: "), shuntvoltage, "mV");
Block1.SendData(F("Cell-2 Current: "), current_mA, "mA");
Block1.SendData(F("Cell-2 Power: "), power_mW, "mW");
//--------------------------------------------------------------------
ct++; Serial.print(" Bay-"); Serial.print(ct);
CellTest(3,2);
Block1.SendData(F("Cell-3"), ct, "Status");
Block1.SendData(F("Cell-3 Bus: "), busvoltage, "V");
Block1.SendData(F("Cell-3 Shunt: "), shuntvoltage, "mV");
Block1.SendData(F("Cell-3 Current: "), current_mA, "mA");
Block1.SendData(F("Cell-3 Power: "), power_mW, "mW");
//--------------------------------------------------------------------
ct++; Serial.print(" Bay-"); Serial.print(ct);
CellTest(3,3);
Block1.SendData(F("Cell-4"), ct, "Status");
Block1.SendData(F("Cell-4 Bus: "), busvoltage, "V");
Block1.SendData(F("Cell-4 Shunt: "), shuntvoltage, "mV");
Block1.SendData(F("Cell-4 Current: "), current_mA, "mA");
Block1.SendData(F("Cell-4 Power: "), power_mW, "mW");
//--------------------------------------------------------------------
ct++; Serial.print(" Bay-"); Serial.print(ct);
CellTest(4,0);
Table Block2("Block2");
Block2.SendData(F("Cell-5"), ct, "Status");
Block2.SendData(F("Cell-5 Bus: "), busvoltage, "V");
Block2.SendData(F("Cell-5 Shunt: "), shuntvoltage, "mV");
Block2.SendData(F("Cell-5 Current: "), current_mA, "mA");
Block2.SendData(F("Cell-5 Power: "), power_mW, "mW");
//--------------------------------------------------------------------
ct++; Serial.print(" Bay-"); Serial.print(ct);
CellTest(4,1);
Block2.SendData(F("Cell-6"), ct, "Status");
Block2.SendData(F("Cell-6 Bus: "), busvoltage, "V");
Block2.SendData(F("Cell-6 Shunt: "), shuntvoltage, "mV");
Block2.SendData(F("Cell-6 Current: "), current_mA, "mA");
Block2.SendData(F("Cell-6 Power: "), power_mW, "mW");
//--------------------------------------------------------------------
ct++; Serial.print(" Bay-"); Serial.print(ct);
CellTest(4,2);
Block2.SendData(F("Cell-7"), ct, "Status");
Block2.SendData(F("Cell-7 Bus: "), busvoltage, "V");
Block2.SendData(F("Cell-7 Shunt: "), shuntvoltage, "mV");
Block2.SendData(F("Cell-7 Current: "), current_mA, "mA");
Block2.SendData(F("Cell-7 Power: "), power_mW, "mW");
//--------------------------------------------------------------------
ct++; Serial.print(" Bay-"); Serial.print(ct);
CellTest(4,3);
Block2.SendData(F("Cell-8"), ct, "Status");
Block2.SendData(F("Cell-8 Bus: "), busvoltage, "V");
Block2.SendData(F("Cell-8 Shunt: "), shuntvoltage, "mV");
Block2.SendData(F("Cell-8 Current: "), current_mA, "mA");
Block2.SendData(F("Cell-8 Power: "), power_mW, "mW");
//--------------------------------------------------------------------
ct++; Serial.print(" Bay-"); Serial.print(ct);
CellTest(5, 0);
Table Block3("Block3");
Block3.SendData(F("Cell-9"), ct, "Status");
Block3.SendData(F("Cell-9 Bus: "), busvoltage, "V");
Block3.SendData(F("Cell-9 Shunt: "), shuntvoltage, "mV");
Block3.SendData(F("Cell-9 Current: "), current_mA, "mA");
Block3.SendData(F("Cell-9 Power: "), power_mW, "mW");
//--------------------------------------------------------------------
ct++; Serial.print(" Bay-"); Serial.print(ct);
CellTest(5,1);
Block3.SendData(F("Cell-10"), ct, "Status");
Block3.SendData(F("Cell-10 Bus: "), busvoltage, "V");
Block3.SendData(F("Cell-10 Shunt: "), shuntvoltage, "mV");
Block3.SendData(F("Cell-10 Current: "), current_mA, "mA");
Block3.SendData(F("Cell-10 Power: "), power_mW, "mW");
//--------------------------------------------------------------------
ct++; Serial.print(" Bay-"); Serial.print(ct);
CellTest(5,2);
Block3.SendData(F("Cell-11"), ct, "Status");
Block3.SendData(F("Cell-11 Bus: "), busvoltage, "V");
Block3.SendData(F("Cell-11 Shunt: "), shuntvoltage, "mV");
Block3.SendData(F("Cell-11 Current: "), current_mA, "mA");
Block3.SendData(F("Cell-11 Power: "), power_mW, "mW");
//--------------------------------------------------------------------
ct++; Serial.print(" Bay-"); Serial.print(ct);
CellTest(5,3);
Block3.SendData(F("Cell-12"), ct, "Status");
Block3.SendData(F("Cell-12 Bus: "), busvoltage, "V");
Block3.SendData(F("Cell-12 Shunt: "), shuntvoltage, "mV");
Block3.SendData(F("Cell-12 Current: "), current_mA, "mA");
Block3.SendData(F("Cell-12 Power: "), power_mW, "mW");
//--------------------------------------------------------------------
ct++; Serial.print(" Bay-"); Serial.print(ct);
CellTest(6,0);
Table Block4("Block4");
Block4.SendData(F("Cell-13"), ct, "Status");
Block4.SendData(F("Cell-13 Bus: "), busvoltage, "V");
Block4.SendData(F("Cell-13 Shunt: "), shuntvoltage, "mV");
Block4.SendData(F("Cell-13 Current: "), current_mA, "mA");
Block4.SendData(F("Cell-13 Power: "), power_mW, "mW");
//--------------------------------------------------------------------
ct++; Serial.print(" Bay-"); Serial.print(ct);
CellTest(6,1);
Block4.SendData(F("Cell-14"), ct, "Status");
Block4.SendData(F("Cell-14 Bus: "), busvoltage, "V");
Block4.SendData(F("Cell-14 Shunt: "), shuntvoltage, "mV");
Block4.SendData(F("Cell-14 Current: "), current_mA, "mA");
Block4.SendData(F("Cell-14 Power: "), power_mW, "mW");
//--------------------------------------------------------------------
ct++; Serial.print(" Bay-"); Serial.print(ct);
CellTest(6,2);
Block4.SendData(F("Cell-15"), ct, "Status");
Block4.SendData(F("Cell-15 Bus: "), busvoltage, "V");
Block4.SendData(F("Cell-15 Shunt: "), shuntvoltage, "mV");
Block4.SendData(F("Cell-15 Current: "), current_mA, "mA");
Block4.SendData(F("Cell-15 Power: "), power_mW, "mW");
//--------------------------------------------------------------------
ct++; Serial.print(" Bay-"); Serial.print(ct);
CellTest(6,3);
Block4.SendData(F("Cell-16"), ct, "Status");
Block4.SendData(F("Cell-16 Bus: "), busvoltage, "V");
Block4.SendData(F("Cell-16 Shunt: "), shuntvoltage, "mV");
Block4.SendData(F("Cell-16 Current: "), current_mA, "mA");
Block4.SendData(F("Cell-16 Power: "), power_mW, "mW");
//--------------------------------------------------------------------
ct++; Serial.print(" Bay-"); Serial.println(ct);
CellTest(7,0);
Table Block5("Block5");
Block5.SendData(F("Cell-17"), ct, "Status");
Block5.SendData(F("Cell-17 Bus: "), busvoltage, "V");
Block5.SendData(F("Cell-17 Shunt: "), shuntvoltage, "mV");
Block5.SendData(F("Cell-17 Current: "), current_mA, "mA");
Block5.SendData(F("Cell-17 Power: "), power_mW, "mW");
//--------------------------------------------------------------------
ct++; Serial.print(" Bay-"); Serial.println(ct);
CellTest(7,1);
Block5.SendData(F("Cell-18"), ct, "Status");
Block5.SendData(F("Cell-18 Bus: "), busvoltage, "V");
Block5.SendData(F("Cell-18 Shunt: "), shuntvoltage, "mV");
Block5.SendData(F("Cell-18 Current: "), current_mA, "mA");
Block5.SendData(F("Cell-18 Power: "), power_mW, "mW");
//--------------------------------------------------------------------
ct++; Serial.print(" Bay-"); Serial.print(ct);
CellTest(7,2);
Block5.SendData(F("Cell-19"), ct, "Status");
Block5.SendData(F("Cell-19 Bus: "), busvoltage, "V");
Block5.SendData(F("Cell-19 Shunt: "), shuntvoltage, "mV");
Block5.SendData(F("Cell-19 Current: "), current_mA, "mA");
Block5.SendData(F("Cell-19 Power: "), power_mW, "mW");
//--------------------------------------------------------------------
ct++; Serial.print(" Bay-"); Serial.println(ct); // this is a debug line
CellTest(7,3);
Block5.SendData(F("Cell-20"), ct, "Status");
Block5.SendData(F("Cell-20 Bus: "), busvoltage, "V");
Block5.SendData(F("Cell-20 Shunt: "), shuntvoltage, "mV");
Block5.SendData(F("Cell-20 Current: "), current_mA, "mA");
Block5.SendData(F("Cell-20 Power: "), power_mW, "mW");
}
As you can see, writing 4 Sensors to 5 tables takes much more repetitive coding to succeed.
Now I know not everyone is crazy like me and builds a large project, but even a smaller project like a area surveillance system with say 10 sensors would benefit from the ability to use a "$string " function like the old basic programming from 30 or more year ago.
I *hope* I have explained it a bit better, again sorry for the long post.
Mike.