mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-24 00:35:39 +03:00
Make SBufWriteString write string without terminating zero
This commit is contained in:
parent
2eb36ed969
commit
7582cf86b4
2 changed files with 3 additions and 2 deletions
|
@ -62,7 +62,7 @@ void sbufWriteData(sbuf_t *dst, const void *data, int len)
|
|||
|
||||
void sbufWriteString(sbuf_t *dst, const char *string)
|
||||
{
|
||||
sbufWriteData(dst, string, strlen(string) + 1); // include zero terminator
|
||||
sbufWriteData(dst, string, strlen(string));
|
||||
}
|
||||
|
||||
uint8_t sbufReadU8(sbuf_t *src)
|
||||
|
|
|
@ -204,7 +204,7 @@ void crsfFrameAttitude(sbuf_t *dst)
|
|||
/*
|
||||
0x21 Flight mode text based
|
||||
Payload:
|
||||
char[] Flight mode ( Nullterminated string )
|
||||
char[] Flight mode ( Nullterminated string )
|
||||
*/
|
||||
void crsfFrameFlightMode(sbuf_t *dst)
|
||||
{
|
||||
|
@ -226,6 +226,7 @@ void crsfFrameFlightMode(sbuf_t *dst)
|
|||
flightMode = "HOR";
|
||||
}
|
||||
sbufWriteString(dst, flightMode);
|
||||
sbufWriteU8(dst, '\0'); // zero-terminate string
|
||||
// write in the frame length
|
||||
*lengthPtr = sbufPtr(dst) - lengthPtr;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue