1
0
Fork 0
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:
Petr Ledvina 2017-05-22 11:41:34 +02:00
parent 2eb36ed969
commit 7582cf86b4
2 changed files with 3 additions and 2 deletions

View file

@ -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)

View file

@ -204,7 +204,7 @@ void crsfFrameAttitude(sbuf_t *dst)
/*
0x21 Flight mode text based
Payload:
char[] Flight mode ( Null­terminated string )
char[] Flight mode ( Null­terminated 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;
}