[sky9x] Massstorage: status bar
This commit is contained in:
@@ -34,6 +34,7 @@
|
||||
#ifndef board_ersky9x_h
|
||||
#define board_ersky9x_h
|
||||
|
||||
#include <stdio.h>
|
||||
#include "ersky9x/board.h"
|
||||
#include "ersky9x/sound_driver.h"
|
||||
#include "ersky9x/haptic_driver.h"
|
||||
|
||||
@@ -32,7 +32,6 @@
|
||||
*/
|
||||
|
||||
#include "../open9x.h"
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
/*
|
||||
|
||||
+1
-1
@@ -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
|
||||
|
||||
@@ -667,7 +667,6 @@ uint8_t statusLineHeight = 0;
|
||||
|
||||
void showStatusLine()
|
||||
{
|
||||
statusLineHeight = 0;
|
||||
statusLineTime = get_tmr10ms();
|
||||
}
|
||||
|
||||
|
||||
+32
-6
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user