Skip to content

Commit 32640d3

Browse files
committed
Fix minor issue with SPI transfer when sending strings ending in 0 binary value
1 parent 96fcf26 commit 32640d3

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

coresdk/src/coresdk/raspi_gpio.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,8 @@ namespace splashkit_lib
224224
string raspi_spi_transfer(int handle, const string &send, int count, int &bytes_transfered)
225225
{
226226
#ifdef RASPBERRY_PI
227-
int len = send.size() > count ? count : send.size();
227+
int len = count; // Allows strings ending with a '0' binary value
228+
// int len = send.size() > count ? count : send.size();
228229
char send_buf[len + 1]{};
229230
for (int i = 0; i < len; i++)
230231
{
@@ -479,7 +480,7 @@ namespace splashkit_lib
479480
return -1;
480481
#endif
481482
}
482-
483+
483484
void raspi_set_servo_pulsewidth(gpio_pin pin, int pulsewidth)
484485
{
485486
#ifdef RASPBERRY_PI

0 commit comments

Comments
 (0)