void displayRun() { if(!(PINC&0x01)) { displayMode=MODE_ANALOGUE; command(CLEAR); } else if(!(PINC&0x02)) { displayMode=MODE_FREQ; command(CLEAR); } else if(!(PINC&0x04)) { displayMode=MODE_TC; command(CLEAR); } else if(!(PINC&0x08)) { displayMode=MODE_DIGITAL; command(CLEAR); } switch(displayMode) { case MODE_ANALOGUE : { displayAnalogue(); break; } case MODE_FREQ : { displayFreq(); break; } case MODE_TC : { displayTC(); break; } case MODE_DIGITAL : { break; } } }
// Main int main() { // initial settings, will change to user interactive / eeprom ctx.settings.mode = 3; ctx.settings.maxCtrlWatts = 75000; ctx.settings.maxWatts = 75000; ctx.settings.minTemp = 60; ctx.settings.maxTemp = 300; ctx.settings.tcrValue = 0.00092; ctx.settings.tT = 248; ctx.settings.tW = 56000; ctx.settings.lockRes = false; ctx.settings.flip = false; ctx.settings.stealth = false; ctx.settings.lock = false; ctx.settings.timeout = 10; // init timers uint8_t timeTimer; timeTimer = Timer_CreateTimer(1, 1, incrementTime, 1); uint8_t loopTimer; loopTimer = Timer_CreateTimer(FPS, 1, readyLoop, 1); // init atomizer Atomizer_SetErrorLock(true); // main loop, rest is event handling while(1) { loop = 0; // collect runtime data collectData(); // do controls doControls(); if(ctx.state.firing) { displayFiring(); } else { if(ctx.state.idleTimer < 20) { switch(ctx.settings.mode) { case 0: // settings displaySettings(); break; case 1: // vw displayVW(); break; case 2: // bp displayBP(); break; case 3: // tc displayTC(); break; } } else { // switch to low power mode Display_Clear(); Display_Update(); sleep(); } } // waste time until loop refresh timer is ready while(loop == 0) {} } return 0; }