コード例 #1
0
ファイル: Strategy.cpp プロジェクト: Djok39/cheali-charger
    Strategy::statusType doStrategy()
    {
        Screen::keyboardButton = BUTTON_NONE;
        bool run = true;
        uint16_t newMesurmentData = 0;
        Strategy::statusType status = Strategy::RUNNING;
        strategyPowerOn();
        do {
            Screen::keyboardButton =  Keyboard::getPressedWithSpeed();
            Screen::doStrategy();

            if(run) {
                status = Monitor::run();
                run = analizeStrategyStatus(status);

                if(run && newMesurmentData != AnalogInputs::getFullMeasurementCount()) {
                    newMesurmentData = AnalogInputs::getFullMeasurementCount();
                    status = strategyDoStrategy();
                    run = analizeStrategyStatus(status);
                }
            }
            if(!run && exitImmediately && status != Strategy::ERROR)
                break;
        } while(Screen::keyboardButton != BUTTON_STOP);

        strategyPowerOff();
        return status;
    }
コード例 #2
0
    Strategy::statusType doStrategy(const Screen::ScreenType chargeScreens[], bool exitImmediately)
    {
        uint8_t key;
        bool run = true;
        uint16_t newMesurmentData = 0;
        Strategy::statusType status = Strategy::RUNNING;
        strategyPowerOn();
        Screen::powerOn();
        Monitor::powerOn();
        lcdClear();
        uint8_t screen_nr = 0;
        do {
            if(!PolarityCheck::runReversedPolarityInfo()) {
                Screen::display(pgm::read(&chargeScreens[screen_nr]));
            }

            {
                //change displayed screen
                key =  Keyboard::getPressedWithSpeed();
                if(key == BUTTON_INC && pgm::read(&chargeScreens[screen_nr+1]) != Screen::ScreenEnd)
                    { 
#ifndef ENABLE_T_INTERNAL //TODO: after program complete, reconnect battery but wrong cell measurement if disconnected
        if(status == Strategy::COMPLETE) {hardware::setBatteryOutput(true); }  // ADD THIS LINE TO TURN ON THE FAN
#endif

#ifdef ENABLE_SCREENANIMATION
                      Screen::displayAnimation(); 
#endif                     
                      screen_nr++;
                    }
                if(key == BUTTON_DEC && screen_nr > 0) 
                    {
#ifdef ENABLE_SCREENANIMATION
                      Screen::displayAnimation();
#endif
                      screen_nr--;
                    }
                    
            }

            if(run) {
                status = Monitor::run();
                run = analizeStrategyStatus(status, exitImmediately);

                if(run && newMesurmentData != AnalogInputs::getFullMeasurementCount()) {
                    newMesurmentData = AnalogInputs::getFullMeasurementCount();
                    status = strategyDoStrategy();
                    run = analizeStrategyStatus(status, exitImmediately);
                }
            }
            if(!run && exitImmediately)
                return status;
        } while(key != BUTTON_STOP);

        Screen::powerOff();
        strategyPowerOff();
        return status;
    }
コード例 #3
0
    Strategy::statusType doStrategy(const Screen::ScreenType chargeScreens[])
    {
        uint8_t key;
        bool run = true;
        uint16_t newMesurmentData = 0;
        Strategy::statusType status = Strategy::RUNNING;
        strategyPowerOn();
        lcdClear();
        uint8_t screen_nr = 0;
        do {
            if(!PolarityCheck::runReversedPolarityInfo()) {
                Screen::display(pgm::read(&chargeScreens[screen_nr]));
            }

            {
                //change displayed screen
                key =  Keyboard::getPressedWithSpeed();
                if(key == BUTTON_INC && pgm::read(&chargeScreens[screen_nr+1]) != Screen::ScreenEnd) {
#ifdef ENABLE_SCREEN_ANIMATION
                    Screen::displayAnimation();
#endif
                    screen_nr++;
                }
                if(key == BUTTON_DEC && screen_nr > 0) {
#ifdef ENABLE_SCREEN_ANIMATION
                    Screen::displayAnimation();
#endif
                    screen_nr--;
                }
            }

            if(run) {
                status = Monitor::run();
                run = analizeStrategyStatus(status);

                if(run && newMesurmentData != AnalogInputs::getFullMeasurementCount()) {
                    newMesurmentData = AnalogInputs::getFullMeasurementCount();
                    status = strategyDoStrategy();
                    run = analizeStrategyStatus(status);
                }
            }
            if(!run && exitImmediately)
                return status;
        } while(key != BUTTON_STOP);

        strategyPowerOff();
        return status;
    }