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