void lcdPrintEValue(uint16_t x, int8_t dig, bool dot) { const char prefix = ' '; if(dig<=0) return; int8_t xdig = digits(x/1000); xdig+=1+3; // m or . for(;xdig<dig;dig--) lcdPrintChar(prefix); if(dig >= xdig && !dot) { xdig = digits(x); dig--; //m for(;xdig<dig;dig--) lcdPrintChar(prefix); lcdPrintUInt(x); lcdPrintChar('m'); } else if(dig < xdig - 4) { lcdPrintInf(dig); } else { lcdPrintUInt(x/1000); x%=1000; dig -= xdig - 4; if(dig-- >0) lcdPrintChar('.'); if(dig-- >0) lcdPrintDigit(x/100); x%=100; if(dig-- >0) lcdPrintDigit(x/10); x%=10; if(dig-- >0) lcdPrintDigit(x); } }
void SettingsMenu::printDeltaT(AnalogInputs::ValueType dt) { lcdPrintUnsigned(dt/100, 3); lcdPrintChar('.'); lcdPrintDigit((dt%100)/10); lcdPrint_P(PSTR("C/m")); }
void printBalancer(uint8_t cell, AnalogInputs::Type type) { if(cell < MAX_BALANCE_CELLS) { lcdPrintDigit(cell+1); lcdPrintChar(':'); if(AnalogInputs::isConnected(AnalogInputs::Name(AnalogInputs::Vb1+cell))) { lcdPrintAnalog(getBalanceValue(cell, type), 6, type); } else { lcdPrint_P(PSTR(" -- ")); } } }
void lcdPrintTemperature_(AnalogInputs::ValueType x, int8_t dig) { const char prefix = ' '; if(dig<=0) return; int8_t xdig = digits(x/100); xdig+=1+2; // . for(;xdig<dig;dig--) lcdPrintChar(prefix); if(dig < xdig - 3) { lcdPrintInf(dig); } else { lcdPrintUInt(x/100); x%=100; dig -= xdig - 3; if(dig-- >0) lcdPrintChar('.'); if(dig-- >0) lcdPrintDigit(x/10); x%=10; if(dig-- >0) lcdPrintDigit(x); } }
void Screen::displayStartInfo() { lcdSetCursor0_0(); ProgramData::currentProgramData.printBatteryString(4); lcdPrintChar(' '); ProgramData::currentProgramData.printVoltageString(); lcdPrintChar(' '); printProgram2chars(Program::programType_); lcdSetCursor0_1(); uint16_t procent = getChargeProcent(); if(procent == 100) { if(getBlinkOff()) lcdPrintSpaces(4); else lcdPrint_P(PSTR("FUL ")); } else { lcdPrintUnsigned(procent, 2); lcdPrint_P(PSTR("% ")); } int bindex = getBlinkIndex(); if(bindex & 1) analogInputs.printRealValue(AnalogInputs::Vout, 5); else lcdPrintSpaces(5); lcdPrintChar(' '); if(ProgramData::currentProgramData.isLiXX()) { //display balance port if(bindex & 2) analogInputs.printRealValue(AnalogInputs::Vbalancer, 5); else lcdPrintSpaces(5); if(bindex & 4) lcdPrintDigit(analogInputs.getConnectedBalancePorts()); else lcdPrintChar(' '); } else { lcdPrintCharge(ProgramData::currentProgramData.battery.C, 6); lcdPrintSpaces(); } }
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_BANANCE_CELLS; i++) { if(::Balancer::connectedCells & 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_BANANCE_CELLS); } lcdPrintDigit(from+1); lcdPrintChar(':'); printBalancer(from++, type); lcdPrintSpaces(); lcdSetCursor0_1(); if(from < MAX_BANANCE_CELLS) { lcdPrintDigit(from+1); lcdPrintChar(':'); printBalancer(from++, type); } if(from < MAX_BANANCE_CELLS) { lcdPrintDigit(from+1); lcdPrintChar(':'); printBalancer(from, type); } lcdPrintSpaces(); }