diff --git a/src/board_ersky9x.h b/src/board_ersky9x.h index 2dd456239..87be2527c 100644 --- a/src/board_ersky9x.h +++ b/src/board_ersky9x.h @@ -34,6 +34,7 @@ #ifndef board_ersky9x_h #define board_ersky9x_h +#include #include "ersky9x/board.h" #include "ersky9x/sound_driver.h" #include "ersky9x/haptic_driver.h" diff --git a/src/ersky9x/debug.cpp b/src/ersky9x/debug.cpp index 5418e41df..97bbd4d91 100644 --- a/src/ersky9x/debug.cpp +++ b/src/ersky9x/debug.cpp @@ -32,7 +32,6 @@ */ #include "../open9x.h" -#include #include /* diff --git a/src/main_views.cpp b/src/main_views.cpp index 3df6b759e..58ba4bd86 100644 --- a/src/main_views.cpp +++ b/src/main_views.cpp @@ -210,7 +210,7 @@ void menuMainView(uint8_t event) putsTelemetryValue(6*FW-1, 3*FH, temperature, UNIT_DEGREES, BLINK|INVERS|DBLSIZE); } else if (g_vbat100mV > g_eeGeneral.vBatWarn && g_eeGeneral.mAhWarn && (g_eeGeneral.mAhUsed + Current_used * (488 + g_eeGeneral.currentCalib)/8192/36) / 500 >= g_eeGeneral.mAhWarn) { - putsTelemetryValue(6*FW-1, 3*FH, g_eeGeneral.mAhUsed + Current_used*(488 + g_eeGeneral.currentCalib)/8192/36, UNIT_MAH, BLINK|INVERS|DBLSIZE|PREC1); + putsTelemetryValue(7*FW-1, 3*FH, (g_eeGeneral.mAhUsed + Current_used*(488 + g_eeGeneral.currentCalib)/8192/36)/10, UNIT_MAH, BLINK|INVERS|DBLSIZE); } else #endif diff --git a/src/menus.cpp b/src/menus.cpp index a0ee6405d..166232215 100644 --- a/src/menus.cpp +++ b/src/menus.cpp @@ -667,7 +667,6 @@ uint8_t statusLineHeight = 0; void showStatusLine() { - statusLineHeight = 0; statusLineTime = get_tmr10ms(); } diff --git a/src/open9x.cpp b/src/open9x.cpp index b7f61d5dd..f3a18852a 100644 --- a/src/open9x.cpp +++ b/src/open9x.cpp @@ -3341,10 +3341,34 @@ Media medias[MAX_LUNS]; /** Device LUNs. */ MSDLun luns[MAX_LUNS]; +char *bytes2Str(char *str, uint32_t bytes) +{ + if (bytes < 1024*100) + sprintf(str, "%lu.%luK", bytes / 1024, (bytes % 1024) / 103); + else if (bytes < 1024*1024) + sprintf(str, "%luK", bytes / 1024); + else if (bytes < 1024*1024*100) + sprintf(str, "%lu.%luM", bytes / (1024*1024), (bytes % (1024*1024)) / 104858); + else + sprintf(str, "%luM", bytes / (1024*1024)); + return str; +} + +unsigned int msdReadTotal=0, msdWriteTotal=0; + static void MSDCallbacks_Data( unsigned char flowDirection, unsigned int dataLength, unsigned int fifoNullCount, unsigned int fifoFullCount ) { - TRACE_INFO("MSDCallbacks_Data\n\r"); + if (flowDirection) + msdReadTotal += dataLength; + else + msdWriteTotal += dataLength; + + char rdStr[10]; + char wrStr[10]; + + sprintf(statusLineMsg, "USB Rd:%s Wr:%s", bytes2Str(rdStr, msdReadTotal), bytes2Str(wrStr, msdWriteTotal)); + showStatusLine(); } unsigned char MEDSdcard_Initialize(Media *media, unsigned char mciID); @@ -3379,8 +3403,8 @@ void usbMassStorage() } /* Mass storage state machine */ - TRACE_DEBUG("MSDDriver_StateMachine\n\r"); - MSDDriver_StateMachine(); + for (uint8_t i=0; i<20; i++) + MSDDriver_StateMachine(); } } // extern "C" @@ -3392,9 +3416,11 @@ void menusTask(void * pdata) perMain(); for (uint8_t i=0; i<5; i++) { if (PIOC->PIO_PDSR & PIO_PC25) { - for (uint8_t i=0; i<10; i++) - usbMassStorage(); - TRACE_DEBUG("Apres usbMassStorage\n\r"); + usbMassStorage(); + } + else { + msdReadTotal = 0; + msdWriteTotal = 0; } CoTickDelay(1); // 10ms for now }