void Display::DisplayCycle() { char buf[16]; iLcd.setCursor(0, 3); sprintf_P(buf, CYCLE_FORM_STR, GetThermocycler().GetCurrentCycleNum(), GetThermocycler().GetNumCycles()); iLcd.print(buf); }
void Thermocycler::ProcessCommand(SCommand& command) { if (command.command == SCommand::EStart) { //find display cycle Cycle* pProgram = command.pProgram; Cycle* pDisplayCycle = pProgram; int largestCycleCount = 0; for (int i = 0; i < pProgram->GetNumComponents(); i++) { ProgramComponent* pComp = pProgram->GetComponent(i); if (pComp->GetType() == ProgramComponent::ECycle) { Cycle* pCycle = (Cycle*)pComp; if (pCycle->GetNumCycles() > largestCycleCount) { largestCycleCount = pCycle->GetNumCycles(); pDisplayCycle = pCycle; } } } GetThermocycler().SetProgram(pProgram, pDisplayCycle, command.name, command.lidTemp); GetThermocycler().Start(); } else if (command.command == SCommand::EStop) { GetThermocycler().Stop(); //redundant as we already stopped during parsing } else if (command.command == SCommand::EConfig) { //update displayed ipDisplay->SetContrast(command.contrast); //update stored contrast ProgramStore::StoreContrast(command.contrast); } }
void Display::Update() { Thermocycler::ProgramState state = GetThermocycler().GetProgramState(); if (iLastState != state) iLcd.clear(); iLastState = state; // check for reset if (millis() - iLastReset > RESET_INTERVAL) { iLcd.begin(20, 4); iLastReset = millis(); } switch (state) { case Thermocycler::ERunning: case Thermocycler::EComplete: case Thermocycler::ELidWait: case Thermocycler::EStopped: iLcd.setCursor(0, 1); #ifdef DEBUG_DISPLAY iLcd.print(iszDebugMsg); #else iLcd.print(GetThermocycler().GetProgName()); #endif DisplayLidTemp(); DisplayBlockTemp(); DisplayState(); if (state == Thermocycler::ERunning && !GetThermocycler().GetCurrentStep()->IsFinal()) { DisplayCycle(); DisplayEta(); } else if (state == Thermocycler::EComplete) { iLcd.setCursor(0, 3); iLcd.print(rps(RUN_COMPLETE_STR)); } break; case Thermocycler::EOff: case Thermocycler::EStartup: iLcd.setCursor(6, 1); iLcd.print(rps(OPENPCR_STR)); if (state == Thermocycler::EOff) { iLcd.setCursor(4, 2); iLcd.print(rps(POWERED_OFF_STR)); } else { iLcd.setCursor(3, 2); iLcd.print(rps(VERSION_STR)); } break; } }
void Display::DisplayLidTemp() { char buf[16]; sprintf_P(buf, LID_FORM_STR, (int)(GetThermocycler().GetLidTemp() + 0.5)); iLcd.setCursor(10, 2); iLcd.print(buf); }
void Display::DisplayBlockTemp() { char buf[16]; char floatStr[16]; sprintFloat(floatStr, GetThermocycler().GetPlateTemp(), 1, true); sprintf_P(buf, BLOCK_TEMP_FORM_STR, floatStr); iLcd.setCursor(13, 0); iLcd.print(buf); }
void Display::DisplayState() { char buf[32]; char* stateStr; switch (GetThermocycler().GetProgramState()) { case Thermocycler::ELidWait: stateStr = rps(LIDWAIT_STR); break; case Thermocycler::ERunning: case Thermocycler::EComplete: switch (GetThermocycler().GetThermalState()) { case Thermocycler::EHeating: stateStr = rps(HEATING_STR); break; case Thermocycler::ECooling: stateStr = rps(COOLING_STR); break; case Thermocycler::EHolding: stateStr = GetThermocycler().GetCurrentStep()->GetName(); break; case Thermocycler::EIdle: stateStr = rps(STOPPED_STR); break; } break; case Thermocycler::EStopped: stateStr = rps(STOPPED_STR); break; } iLcd.setCursor(0, 0); sprintf_P(buf, STATE_FORM_STR, stateStr); iLcd.print(buf); }
void Display::DisplayEta() { char timeString[16]; unsigned long timeRemaining = GetThermocycler().GetTimeRemainingS(); int hours = timeRemaining / 3600; int mins = (timeRemaining % 3600) / 60; int secs = timeRemaining % 60; if (hours >= 10) strcpy_P(timeString, ETA_OVER_10H_STR); else if (mins >= 1 || hours >= 1) sprintf_P(timeString, ETA_HOURMIN_FORM_STR, hours, mins); else sprintf_P(timeString, ETA_SEC_FORM_STR, secs); iLcd.setCursor(11, 3); iLcd.print(timeString); }