void displayBalanceInfo(uint8_t from, AnalogInputs::Type type)
    {
        lcdSetCursor0_0();

#ifdef ENABLE_SCREEN_KNIGHTRIDEREFFECT
        knightRiderCounter += knightRiderDir;
        if (knightRiderCounter==0 || knightRiderCounter>4) knightRiderDir=-knightRiderDir;
#endif
        char c = ' ';
        if(!::Balancer::isWorking()) {
            if(!::Balancer::isStable())
                c = 'm';
        } else {
            if(::Balancer::savedVon)
                c = 'B';
            else
                c = 'b';
        }

        if (::Balancer::balance == 0) {
            lcdPrintChar(c);
#ifdef ENABLE_SCREEN_KNIGHTRIDEREFFECT
            char knightRiderArrow;
            if (knightRiderDir > 0) knightRiderArrow='>'; else knightRiderArrow='<';
            if ((c == 'm') || (c == ' ')) {
                for (uint8_t i=0; i<6; i++ ) {
                    if (knightRiderCounter==i) lcdPrintChar(knightRiderArrow);
                    else lcdPrintChar(' ');
                }
                lcdPrintChar(' ');
            } else {
                lcdPrintSpaces(7);
            }
#else
        lcdPrintSpaces(7);
#endif
        } else {
            uint16_t cell = 1;
            for(uint8_t i = 0; i < MAX_BALANCE_CELLS; i++) {
                if(AnalogInputs::connectedBalancePortCells & cell) {
                    if(i == ::Balancer::minCell) {
                        c = SCREEN_EMPTY_CELL_CHAR; //lowest cell
                    } else {
                        if(::Balancer::balance & cell) {
                            if (Blink::blinkTime_ & 1) {
                                c = SCREEN_FULL_CELL_CHAR; //flash full/empty cells
                            } else {
                                c = SCREEN_EMPTY_CELL_CHAR; //flash full/empty cells
                            }
                        } else {
                         c = SCREEN_AVR_CELL_CHAR; //average cells
                        }
                    }
                } else {
                    c = ' ';
                }
                lcdPrintChar(c);
                cell <<= 1;
            }
            lcdPrintSpaces(8 - MAX_BALANCE_CELLS);
        }
        printBalancer(from++, type);
        lcdPrintSpaces();

        lcdSetCursor0_1();
        printBalancer(from++, type);
        printBalancer(from++, type);
        lcdPrintSpaces();
    }
Example #2
0
uint8_t lcdPrintSpaces()
{
    return lcdPrintSpaces(16);
}