AWOL:
{ "PVCurrent", PVCurrent },A preprocessor stringify operator in a macro could help here.
As AWOL suggests, the table of variables/names could be done with a macro like this:
#define MAKE_VAR(v) #v, v
xVar vals [] = {
{ MAKE_VAR (BatVolts) },
{ MAKE_VAR (ACVolts) },
{ MAKE_VAR (WindSpeed) },
{ MAKE_VAR (PVCurrent) },
};
Now you only have to type the variable name once. The lines expand out to what I had before. The above was for the "references" version, this is for the pointers version:
#define MAKE_VAR(v) #v, &v
xVar vals [] = {
{ MAKE_VAR (BatVolts) },
{ MAKE_VAR (ACVolts) },
{ MAKE_VAR (WindSpeed) },
{ MAKE_VAR (PVCurrent) },
};