ezapp_field_index_t strIndex, rpmIndex, damperIndex, fan1Index, fan2Index;
rom char* title = "Air Handler Unit 3269";
HW_INIT();
EZAppInit();
EZAppSetTitleROM(title);
EZAppSetValueStringROM(EZAppAddFieldString(), title);
strIndex = EZAppAddFieldString();
rpmIndex = EZAppAddFieldAnalogValue(
(rom char *)"RPM X 1000", //header
EZAPP_ANALOG_TYPE_SLIDER, //display type
1024, //max value
9 //scaling
);
damperIndex = EZAppAddFieldAnalogValue(
(rom char *)"DAMPER", //header
EZAPP_ANALOG_TYPE_SLIDER, //display type
1023 //max value
);
fan1Index = EZAppAddFieldButtonTwoState(
(rom char*)"Fan 1", //header
(rom char*)"Off\tOn" //strings that go in button
);
fan2Index = EZAppAddFieldButtonTwoState(
(rom char*)"Fan 2", //header
(rom char*)"Off\tOn" //strings that go in button
);
for(;;)
{
EZAppTask();
if (IsFailure())
{
EZAppSetValueStringROM(strIndex, (rom char*)"Operation: Failure");
}
else
{
EZAppSetValueStringROM(strIndex, (rom char*)"Operation: Normal");
}
EZAppSetValue(rpmIndex, read_adc());
if (EZAppGetKbhit(damperIndex))
SetDamper(EZAppGetValue(damperIndex));
if (EZAppGetKbhit(fan1Index))
SetFan1(EZAppGetValue(fan1Index));
if (EZAppGetKbhit(fan2Index))
SetFan2(EZAppGetValue(fan2Index));
}