[sky9x] Massstorage: status bar
This commit is contained in:
@@ -34,6 +34,7 @@
|
|||||||
#ifndef board_ersky9x_h
|
#ifndef board_ersky9x_h
|
||||||
#define board_ersky9x_h
|
#define board_ersky9x_h
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
#include "ersky9x/board.h"
|
#include "ersky9x/board.h"
|
||||||
#include "ersky9x/sound_driver.h"
|
#include "ersky9x/sound_driver.h"
|
||||||
#include "ersky9x/haptic_driver.h"
|
#include "ersky9x/haptic_driver.h"
|
||||||
|
|||||||
@@ -32,7 +32,6 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "../open9x.h"
|
#include "../open9x.h"
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdarg.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);
|
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) {
|
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
|
else
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -667,7 +667,6 @@ uint8_t statusLineHeight = 0;
|
|||||||
|
|
||||||
void showStatusLine()
|
void showStatusLine()
|
||||||
{
|
{
|
||||||
statusLineHeight = 0;
|
|
||||||
statusLineTime = get_tmr10ms();
|
statusLineTime = get_tmr10ms();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+32
-6
@@ -3341,10 +3341,34 @@ Media medias[MAX_LUNS];
|
|||||||
/** Device LUNs. */
|
/** Device LUNs. */
|
||||||
MSDLun luns[MAX_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,
|
static void MSDCallbacks_Data( unsigned char flowDirection, unsigned int dataLength,
|
||||||
unsigned int fifoNullCount, unsigned int fifoFullCount )
|
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);
|
unsigned char MEDSdcard_Initialize(Media *media, unsigned char mciID);
|
||||||
@@ -3379,8 +3403,8 @@ void usbMassStorage()
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Mass storage state machine */
|
/* Mass storage state machine */
|
||||||
TRACE_DEBUG("MSDDriver_StateMachine\n\r");
|
for (uint8_t i=0; i<20; i++)
|
||||||
MSDDriver_StateMachine();
|
MSDDriver_StateMachine();
|
||||||
}
|
}
|
||||||
} // extern "C"
|
} // extern "C"
|
||||||
|
|
||||||
@@ -3392,9 +3416,11 @@ void menusTask(void * pdata)
|
|||||||
perMain();
|
perMain();
|
||||||
for (uint8_t i=0; i<5; i++) {
|
for (uint8_t i=0; i<5; i++) {
|
||||||
if (PIOC->PIO_PDSR & PIO_PC25) {
|
if (PIOC->PIO_PDSR & PIO_PC25) {
|
||||||
for (uint8_t i=0; i<10; i++)
|
usbMassStorage();
|
||||||
usbMassStorage();
|
}
|
||||||
TRACE_DEBUG("Apres usbMassStorage\n\r");
|
else {
|
||||||
|
msdReadTotal = 0;
|
||||||
|
msdWriteTotal = 0;
|
||||||
}
|
}
|
||||||
CoTickDelay(1); // 10ms for now
|
CoTickDelay(1); // 10ms for now
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user