Skip to content

Commit

Permalink
Config file cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
tomcourt authored and tomcourt committed Jul 24, 2017
1 parent 424ebc1 commit 2d588c4
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 53 deletions.
96 changes: 48 additions & 48 deletions enguino/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,71 +32,71 @@
// st_fuel_flow

// sensor-type, pin, decimal, voffset, vfactor, goffset, gfactor,lowWarning,lowCaution,highCaution,highWarning
const Sensor voltS = { st_volts, 0, 1, 0, SCALE(.200), GMIN(100*fromV), GRNG(60*fromV), 110, 130, 9999, 160 };
const Sensor oilpS = { st_v240to33, 1, 0, 0, SCALE(.100), 0, SCALE(1.), 25, 55, 9999, 95 };
const Sensor oilpS = { st_v240to33, 1, 0, 0, SCALE(.100), 0, SCALE(1.), 25, 55, 9999, 95 };
const Sensor oiltS = { st_thermistorF, 2, 0, 0, SCALE(.100), GMIN(50*10), GRNG(200*10), -1, 140, 9999, 250 };
const Sensor voltS = { st_volts, 0, 1, 0, SCALE(.200), GMIN(100*fromV), GRNG(60*fromV), 110, 130, 9999, 160 };
const Sensor fuelpS = { st_v240to33, 3, 1, 0, SCALE(.150), 0, SCALE(150./100.), 5, 20, 60, 80 };
const Sensor fuellS = { st_v240to33, DUAL(4), 1, 0, SCALE(.160), 0, SCALE(1.), 25, 50, 9999, 999 };
const Sensor tachS = { st_tachometer, 15, 0, 0, SCALE(1.), GMIN(0), GRNG(3000), -1, 500, 9999, 2700 };
const Sensor mapS = { st_volts, -1, 1, 31, SCALE(.32811), GMIN(210), GRNG(25/32.811), -1, -1, 9999, 9999 };
const Sensor chtS = { st_k_type_tcF, 16, 0, 0, SCALE(.25), GMIN(100*4), GRNG(400*4), -1, 150, 400, 500 };
const Sensor egtS = { st_k_type_tcF, 20, 0, 0, SCALE(.25), GMIN(1000*4), GRNG(600*4), -1, -1, 9999, 9999 };

// Labels
// Labels
// ------
string opLV[] = { "80", "60", "40", "20" };
const int opLP[] = { 800, 1600, 2400, 3200 };
string otLV[] = { "200", "150", "100" };
const int otLP[] = { 1000, 2000, 3000 };
string vtLV[] = { "14", "12" };
const int vtLP[] = { 1330, 2670 };
string fpLV[] = { "8", "6", "4", "2" };
const int fpLP[] = { 800, 1600, 2400, 3200 };
string flLV[] = { "15", "10", "5", "2.5" };
const int flLP[] = { 250, 1500, 2750, 3375 };
string chLV[] = { "200°F", "300°F", "400°F" };
const int chLP[] = { 2000, 4000, 6000 };
string egLV[] = { "1150°", "1300°", "1450°" };
const int egLP[] = { 2000, 4000, 6000 };
string oilpLV[] = { "80", "60", "40", "20" };
const int oilpLP[] = { VSEG(80./100.), VSEG(60./100.), VSEG(40./100.), VSEG(20./100.) };
string oiltLV[] = { "200", "150", "100" };
const int oiltLP[] = { VSEG(150./200.), VSEG(100./200.), VSEG(50./200.) }; // offset and range offset by 50 deg-F
string voltLV[] = { "14", "12" };
const int voltLP[] = { VSEG(4./6.), VSEG(2./6.) }; // offset and range offset by 10 volts
string fuelpLV[] = { "8", "6", "4", "2" };
const int fuelpLP[] = { VSEG(8./10.), VSEG(6./10.), VSEG(4./10.), VSEG(2./10.) };
string fuellLV[] = { "15", "10", "5", "2.5" };
const int fuellLP[] = { VSEG(15./16.), VSEG(10./16.), VSEG(5./16.), VSEG(2.5/16.) };
string chtLV[] = { "200°F", "300°F", "400°F" };
const int chtLP[] = { HSEG(100./400.), HSEG(200./400.), HSEG(300./400.) }; // offset and range offset by 100 deg-F
string egtLV[] = { "1150°", "1300°", "1450°" };
const int egtLP[] = { HSEG(150./600.), HSEG(300./600.), HSEG(450./600.) }; // offset and range offset by 1000 deg-F

// Color regions
// -------------
string opRC[] = { red, yellow, green, red };
int opRP[] = { 1000, 2200, 3800, 4000 };
string otRC[] = { yellow, green, red };
int otRP[] = { 1800, 3925, 4000 };
string vtRC[] = { red, yellow, green, yellow, red };
int vtRP[] = { 700, 2000, 3330, 3925, 4000 };
string fpRC[] = { red, yellow, green, yellow, red };
int fpRP[] = { 200, 800, 2400, 3200, 4000 };
string flRC[] = { red, yellow, green };
int flRP[] = { 625, 1250, 4000 };
string taRC[] = { yellow, green, red };
int taRP[] = { ARCX(5./30.)-1, ARCX(27./30.), ARCX(1), // x (-1 tweak on the arc to get green arc to overlay black arc well, small truncation here causes big arc error)
ARCY(5./30.), ARCY(27./30.), ARCY(1), // y
0, 0, 0 }; // > 180 degrees
string maRC[] = { green };
int maRP[] = { ARCX(1), // x
ARCY(1), // y
1 }; // > 180 degrees
string chRC[] = { yellow, green, yellow, red };
int chRP[] = { 1000, 6000, 7940, 8000 };
string oilpRC[] = { red, yellow, green, red };
int oilpRP[] = { VSEG(25./100.), VSEG(55./100.), VSEG(95./100.), VSEG(1) };
string oiltRC[] = { yellow, green, red };
int oiltRP[] = { VSEG(40./200.), VSEG(198./200.), VSEG(1) }; // offset and range offset by 50 deg-F
string voltRC[] = { red, yellow, green, yellow, red };
int voltRP[] = { VSEG(1./6.), VSEG(3./6.), VSEG(5./6.), VSEG(5.9/6.), VSEG(1) }; // offset and range offset by 10 volts
string fuelpRC[] = { red, yellow, green, yellow, red };
int fuelpRP[] = { VSEG(.5/10.), VSEG(2./10.), VSEG(6./10.), VSEG(8./10.), VSEG(1) };
string fuellRC[] = { red, yellow, green };
int fuellRP[] = { VSEG(2.5/16.), VSEG(5./16.), VSEG(1) };
string tachRC[] = { yellow, green, red };
int tachRP[] = { ARCX(500./3000.)-1, ARCX(2700./3000.), ARCX(1), // x (-1 tweak on the arc to get green arc to overlay black arc well, small truncation here causes big arc error)
ARCY(500./3000.), ARCY(2700./3000.), ARCY(1), // y
0, 0, 0 }; // > 180 degrees
string mapRC[] = { green };
int mapRP[] = { ARCX(1), // x
ARCY(1), // y
1 }; // > 180 degrees
string chtRC[] = { yellow, green, yellow, red };
int chtRP[] = { HSEG(50./400.), HSEG(300./400.), HSEG(395./400.), HSEG(1) }; // offset and range offset by 100 deg-F

// Gauge layout for screen
// -----------------------
#define bank 3500 // bank of misc vertical gauges
const Gauge gauges[] = {
// x, y, style, label1, label2, units, labVal, labPt, num, regClr, regPt, num, sensor
{bank+0, 0, gs_vert, "OIL", "PRES", "psi", opLV, opLP, N(opLV), opRC, opRP, N(opRC), &oilpS},
{bank+1750, 0, gs_vert, "OIL", "TEMP", "°F", otLV, otLP, N(otLV), otRC, otRP, N(otRC), &oiltS},
{bank+3500, 0, gs_vert, "", "VOLT", "volt", vtLV, vtLP, N(vtLV), vtRC, vtRP, N(vtRC), &voltS},
{bank+5250, 0, gs_vert, "FUEL", "PRES", "psi", fpLV, fpLP, N(fpLV), fpRC, fpRP, N(fpRC), &fuelpS},
{bank+7000, 0, gs_pair, "FUEL", "", "gal", flLV, flLP, N(flLV), flRC, flRP, N(flRC), &fuellS},
{100, 0, gs_round, "TACH", "", "rpm", 0, 0, 0, taRC, taRP, N(taRC), &tachS},
{100, 3200, gs_round, "MP", "", "in-hg", 0, 0, 0, maRC, maRP, N(maRC), &mapS},
{2950, 6150, gs_horiz, "CHT", "", "", chLV, chLP, N(chLV), chRC, chRP, N(chRC), &chtS},
{2950, 6150, gs_aux, "EGT", "", "", egLV, egLP, N(egLV), 0, 0, 0, &egtS},
{800, 6650, gs_infobox,"", "", "", 0, 0, 0, 0, 0, 0, 0}
// x, y, style, label1, label2, units, labVal, labPt, num, regClr, regPt, num, sensor
{bank+0, 0, gs_vert, "OIL", "PRES", "psi", oilpLV, oilpLP, N(oilpLV), oilpRC, oilpRP, N(oilpRC), &oilpS},
{bank+1750, 0, gs_vert, "OIL", "TEMP", "°F", oiltLV, oiltLP, N(oiltLV), oiltRC, oiltRP, N(oiltRC), &oiltS},
{bank+3500, 0, gs_vert, "", "VOLT", "volt", voltLV, voltLP, N(voltLV), voltRC, voltRP, N(voltRC), &voltS},
{bank+5250, 0, gs_vert, "FUEL", "PRES", "psi", fuelpLV, fuelpLP, N(fuelpLV), fuelpRC, fuelpRP, N(fuelpRC), &fuelpS},
{bank+7000, 0, gs_pair, "FUEL", "", "gal", fuellLV, fuellLP, N(fuellLV), fuellRC, fuellRP, N(fuellRC), &fuellS},
{100, 0, gs_round, "TACH", "", "rpm", 0, 0, 0, tachRC, tachRP, N(tachRC), &tachS},
{100, 3200, gs_round, "MP", "", "in-hg", 0, 0, 0, mapRC, mapRP, N(mapRC), &mapS},
{2950, 6150, gs_horiz, "CHT", "", "", chtLV, chtLP, N(chtLV), chtRC, chtRP, N(chtRC), &chtS},
{2950, 6150, gs_aux, "EGT", "", "", egtLV, egtLP, N(egtLV), 0, 0, 0, &egtS},
{800, 6650, gs_infobox,"", "", "", 0, 0, 0, 0, 0, 0, 0}
};

// Guage layout for aux display
Expand Down
6 changes: 6 additions & 0 deletions enguino/egTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,12 @@ typedef struct {
#define DUAL_BIT 64
#define DUAL(x) (DUAL_BIT | (x))

// for a round gauge, calculate the x,y location for a gauge at fraction x of the full 240 degree arc
#define ARCX(x) (.5-(1300 * COS2(((x)*4./3.-1./6.) * PI)))
#define ARCY(x) (.5-(1300 * SIN2(((x)*4./3.-1./6.) * PI)))
#define VSEG(x) (.5+4000*(x))
#define HSEG(x) (.5+8000*(x))

#define AUX(a,b,c,d,top,bottom) {{LED_TEXT(a,b,c,d)},{&top,&bottom}}

const char *green = "green";
Expand Down
4 changes: 2 additions & 2 deletions enguino/printGauges.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ void printVertical(const Gauge *g, bool showLabels=true, byte pinOffset=0) {

// add tick marks and labels
for (int i=0; i<g->n_labels; i++) {
s = g->labelPts[i] + 1000;
s = 4000 + 1000 - g->labelPts[i];
print_P(F("<line class='segment' x1='250' y1='"));
print(s);
print_P(F("' x2='950' y2='"));
Expand Down Expand Up @@ -247,7 +247,7 @@ void printVerticalPair(const Gauge *g) {
// add tick marks and labels
for (int i=0; i<g->n_labels; i++) {
print_P(F("<text x='1350' y='"));
print(g->labelPts[i] + 1100);
print(1000 + 4000 - g->labelPts[i]);
print_P(F("' class='mnumber'>"));
print(g->labelValues[i]);
print_text_close();
Expand Down
3 changes: 0 additions & 3 deletions enguino/utility.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@
#define SIN2(x) ( ((x)<=PI/2.) ? SIN(x) : -SIN((x)-PI) )
#define COS2(x) ( ((x)<=PI/2.) ? COS(x) : -COS((x)-PI) )

// for a round gauge, calculate the x,y location for a gauge at fraction x of the full 240 degree arc
#define ARCX(x) (.5-(1300 * COS2(((x)*4./3.-1./6.) * PI)))
#define ARCY(x) (.5-(1300 * SIN2(((x)*4./3.-1./6.) * PI)))


void logTime(unsigned long start, const char *description) {
Expand Down

0 comments on commit 2d588c4

Please sign in to comment.