Simu async lcd display

This commit is contained in:
bsongis
2011-11-28 21:32:04 +00:00
parent a82d2346a8
commit 6a579226cd
10 changed files with 102 additions and 78 deletions
+17 -7
View File
@@ -17,6 +17,7 @@
*
*/
#define PROGRESS_VERTICAL_BAR
#include "gruvin9x.h"
#include "stdio.h"
@@ -457,7 +458,11 @@ void RlcFile::writeRlc(uint8_t i_fileId, uint8_t typ, uint8_t*buf, uint16_t i_le
m_rlc_buf = buf;
m_rlc_len = i_len;
m_cur_rlc_len = 0;
m_ratio = (typ == FILE_TYP_MODEL ? 60 : 7);
#if defined (PROGRESS_CIRCLE)
m_ratio = (typ == FILE_TYP_MODEL ? 60 : 6);
#elif defined (PROGRESS_VERTICAL_BAR)
m_ratio = (typ == FILE_TYP_MODEL ? 100 : 10);
#endif
do {
nextRlcWriteStep();
@@ -573,10 +578,9 @@ void RlcFile::flush()
s_sync_write = false;
}
#define PROGRESS_CIRCLE
void RlcFile::DisplayProgressBar(uint8_t x)
{
if (s_eeDirtyMsk || m_rlc_len || eeprom_buffer_size) {
if (s_eeDirtyMsk || isWriting() || eeprom_buffer_size) {
#if defined (PROGRESS_BAR)
uint8_t len = (s_eeDirtyMsk ? 123 : min((uint8_t)123, (uint8_t)((m_rlc_len) / 5 + eeprom_buffer_size)));
lcd_filled_rect(2, 1, 125, 5, WHITE);
@@ -585,11 +589,17 @@ void RlcFile::DisplayProgressBar(uint8_t x)
lcd_filled_rect(x-1, 0, 7, 7, WHITE);
uint8_t len = s_eeDirtyMsk ? 1 : limit(1, 12 - (uint8_t)(m_rlc_len/m_ratio), 12);
lcd_hline(x+1, 1, min((uint8_t)3, len));
if (len >= 3) lcd_vline(x+4, 2, min(3, len-3));
if (len >= 6) lcd_hline(x+4, 1+4, -min(3, len-6));
if (len >= 9) lcd_vline(x, 5, -min(3, len-9));
if (len >= 3) {
lcd_vline(x+4, 2, min(3, len-3));
if (len >= 6) {
lcd_hline(x+4, 1+4, -min(3, len-6));
if (len >= 9) {
lcd_vline(x, 5, -min(3, len-9));
}
}
}
#elif defined (PROGRESS_VERTICAL_BAR)
uint8_t len = 6 - (s_eeDirtyMsk ? 5 : min((uint8_t)5, (uint8_t)((m_rlc_len / 100) + (eeprom_buffer_size / 10))));
uint8_t len = s_eeDirtyMsk ? 1 : limit((uint8_t)1, (uint8_t)(7 - (m_rlc_len/m_ratio)), (uint8_t)7);
lcd_filled_rect(x+1, 0, 5, FH, WHITE);
lcd_filled_rect(x+2, 7-len, 3, len);
#elif defined (PROGRESS_FIXED_CIRCLE)