mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-14 20:10:18 +03:00
Comment updates, allow CLI flash read to read more in one operation
This commit is contained in:
parent
3eb28f16ea
commit
2e14faeef6
3 changed files with 21 additions and 16 deletions
|
@ -44,7 +44,6 @@
|
|||
#include "drivers/gpio.h"
|
||||
#include "drivers/timer.h"
|
||||
#include "drivers/pwm_rx.h"
|
||||
#include "drivers/flash_m25p16.h"
|
||||
#include "flight/flight.h"
|
||||
#include "flight/mixer.h"
|
||||
#include "flight/navigation.h"
|
||||
|
@ -794,18 +793,21 @@ static void cliFlashRead(char *cmdline)
|
|||
printf("Missing length argument.\r\n");
|
||||
} else {
|
||||
length = atoi(nextArg);
|
||||
if (length > 32) {
|
||||
length = 32;
|
||||
printf("Length truncated to 32 bytes.\r\n");
|
||||
}
|
||||
|
||||
printf("Reading %u bytes at %u:\r\n", length, address);
|
||||
|
||||
flashfsSeekAbs(address);
|
||||
flashfsRead(buffer, length);
|
||||
|
||||
printf("Read %u bytes at %u:\r\n", length, address);
|
||||
while (length > 0) {
|
||||
int bytesToRead = length < 32 ? length : 32;
|
||||
|
||||
for (i = 0; i < length; i++) {
|
||||
printf("%c", (char) buffer[i]);
|
||||
flashfsRead(buffer, bytesToRead);
|
||||
|
||||
for (i = 0; i < bytesToRead; i++) {
|
||||
printf("%c", (char) buffer[i]);
|
||||
}
|
||||
|
||||
length -= bytesToRead;
|
||||
}
|
||||
printf("\r\n");
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue