ICACHE_FLASH_ATTR bool display_time() { bool update_time = false; char buff[8]; uint8_t hour = time_hour(); uint8_t minute = time_minute(); uint8_t second = time_second(); if(current_time.hour != hour) { current_time.hour = hour; bignumbers_print(hour / 10, 0); bignumbers_print(hour % 10, 3); } if(current_time.minute != minute) { current_time.minute = minute; bignumbers_print(minute / 10, 7); bignumbers_print(minute % 10, 10); update_time = true; } if(current_time.second != second) { current_time.second = second; lcd_set_cursor(14, 1); os_sprintf(buff, "%02d", second); lcd_print(buff); } return update_time; }
fpint solarpanel_capacity(long seconds) { #if SOLARPANEL_EMULATE update_noise(); // calculate energy of solar panel fpint fp_lat = 0xDEDC; // Darmstadt: 49.878667 * PI / 180 = 0.8705 fpint fp_energy = energy_brock(time_day(), time_minute(), fp_lat); fp_energy = energy_corrected(fp_energy, noise_lifetime + noise_day); // convert Watthours to Milliamperhours fpint fp_onethousand = 0x3E80000; fpint fp_mah = fpint_mul(fpint_div(fp_energy, fpint_to(SOLARPANEL_VOLT)), fp_onethousand); // scaled mAh down to timeframe fpint fp_hour = 0xE100000; // 1h in seconds return fpint_mul(fpint_div(fp_mah, fp_hour), fpint_to(seconds)); #else #error no real solarpanel implemented #endif }