mirror of
https://github.com/eddyem/stm32samples.git
synced 2025-12-06 02:35:23 +03:00
fixed a very stupid bug
This commit is contained in:
parent
b20e134180
commit
4d835abe4e
@ -133,7 +133,7 @@ int main(void){
|
||||
#endif
|
||||
cmd_parser(txt, 0);
|
||||
}
|
||||
if(lastTprint - Tms > 249){ // run `sendbuf` each 250ms
|
||||
if(Tms - lastTprint > 249){ // run `sendbuf` each 250ms
|
||||
sendbuf();
|
||||
}
|
||||
}
|
||||
|
||||
@ -77,9 +77,12 @@ void sendbuf(){
|
||||
}else if(s != LINE_BUSY) break;
|
||||
#ifdef EBUG
|
||||
if(DMA1->ISR & DMA_ISR_TCIF2) USB_sendstr("DMA rdy\n");
|
||||
USB_sendstr(" sendbuf: line busy\n");
|
||||
USB_sendstr(" sendbuf(): line busy\n");
|
||||
#endif
|
||||
}
|
||||
#ifdef EBUG
|
||||
USB_sendstr(" sent or not\n");
|
||||
#endif
|
||||
bptr = buff;
|
||||
blen = 0;
|
||||
lastTprint = Tms;
|
||||
@ -90,6 +93,9 @@ void addtobuf(const char *txt){
|
||||
IWDG->KR = IWDG_REFRESH;
|
||||
int l = strlen(txt);
|
||||
if(l > UARTBUFSZ){
|
||||
#ifdef EBUG
|
||||
USB_sendstr("l>UARTBUFSZ -> sendbuf\n");
|
||||
#endif
|
||||
sendbuf(); // send prevoius data in buffer
|
||||
if(cmdsource == SRC_USB) USB_sendstr(txt);
|
||||
else for(int i = 0; i < WAITFOR; ++i){
|
||||
@ -106,6 +112,9 @@ void addtobuf(const char *txt){
|
||||
}
|
||||
}else{
|
||||
if(blen+l > UARTBUFSZ){
|
||||
#ifdef EBUG
|
||||
USB_sendstr("blen+l>UARTBUFSZ -> sendbuf\n");
|
||||
#endif
|
||||
sendbuf();
|
||||
}
|
||||
strcpy(bptr, txt);
|
||||
@ -118,6 +127,9 @@ void addtobuf(const char *txt){
|
||||
|
||||
void bufputchar(char ch){
|
||||
if(blen > UARTBUFSZ-1){
|
||||
#ifdef EBUG
|
||||
USB_sendstr("bufputchar() -> sendbuf\n");
|
||||
#endif
|
||||
sendbuf();
|
||||
}
|
||||
*bptr++ = ch;
|
||||
|
||||
Binary file not shown.
@ -23,7 +23,7 @@
|
||||
#define __USART_H__
|
||||
|
||||
// output buffers size
|
||||
#define UARTBUFSZ (512)
|
||||
#define UARTBUFSZ (1535)
|
||||
// input buffer size
|
||||
#define UARTINBUFSZ (64)
|
||||
// timeout between data bytes
|
||||
|
||||
@ -1,3 +1,3 @@
|
||||
#define BUILD_NUMBER "130"
|
||||
#define BUILD_DATE "2023-09-29"
|
||||
#define BUILDNO 130
|
||||
#define BUILD_NUMBER "139"
|
||||
#define BUILD_DATE "2023-10-02"
|
||||
#define BUILDNO 139
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user