mirror of
https://github.com/opentx/opentx.git
synced 2025-07-21 15:25:17 +03:00
CLI readsd fixes
This commit is contained in:
parent
ac85678616
commit
3fddb28c4f
1 changed files with 11 additions and 4 deletions
|
@ -199,14 +199,21 @@ int cliReadSD(const char ** argv)
|
||||||
tmr10ms_t start = get_tmr10ms();
|
tmr10ms_t start = get_tmr10ms();
|
||||||
|
|
||||||
while (numberOfSectors > 0) {
|
while (numberOfSectors > 0) {
|
||||||
DRESULT res = disk_read(0, buffer, startSector, bufferSectors);
|
DRESULT res = __disk_read(0, buffer, startSector, bufferSectors);
|
||||||
if (res != RES_OK) {
|
if (res != RES_OK) {
|
||||||
serialPrint("disk_read error: %d", res);
|
serialPrint("disk_read error: %d, sector: %d(%d)", res, startSector, numberOfSectors);
|
||||||
free(buffer);
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
// dump(buffer, 32);
|
||||||
|
// // calc checksumm
|
||||||
|
// uint32_t summ = 0;
|
||||||
|
// for(int n=0; n<(bufferSectors*512); ++n) {
|
||||||
|
// summ += buffer[n];
|
||||||
|
// }
|
||||||
|
// serialPrint("sector %d(%d) checksumm: %u", startSector, numberOfSectors, summ);
|
||||||
|
|
||||||
if (numberOfSectors >= bufferSectors) {
|
if (numberOfSectors >= bufferSectors) {
|
||||||
numberOfSectors -= bufferSectors;
|
numberOfSectors -= bufferSectors;
|
||||||
|
startSector += bufferSectors;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
numberOfSectors = 0;
|
numberOfSectors = 0;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue