mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-26 09:45:37 +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)
|
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)
|
uint8_t sbufReadU8(sbuf_t *src)
|
||||||
|
|
|
@ -204,7 +204,7 @@ void crsfFrameAttitude(sbuf_t *dst)
|
||||||
/*
|
/*
|
||||||
0x21 Flight mode text based
|
0x21 Flight mode text based
|
||||||
Payload:
|
Payload:
|
||||||
char[] Flight mode ( Nullterminated string )
|
char[] Flight mode ( Nullterminated string )
|
||||||
*/
|
*/
|
||||||
void crsfFrameFlightMode(sbuf_t *dst)
|
void crsfFrameFlightMode(sbuf_t *dst)
|
||||||
{
|
{
|
||||||
|
@ -226,6 +226,7 @@ void crsfFrameFlightMode(sbuf_t *dst)
|
||||||
flightMode = "HOR";
|
flightMode = "HOR";
|
||||||
}
|
}
|
||||||
sbufWriteString(dst, flightMode);
|
sbufWriteString(dst, flightMode);
|
||||||
|
sbufWriteU8(dst, '\0'); // zero-terminate string
|
||||||
// write in the frame length
|
// write in the frame length
|
||||||
*lengthPtr = sbufPtr(dst) - lengthPtr;
|
*lengthPtr = sbufPtr(dst) - lengthPtr;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue