diff --git a/pigpio.c b/pigpio.c
index 4e5286f..8310e31 100644
--- a/pigpio.c
+++ b/pigpio.c
@@ -25,7 +25,7 @@ OTHER DEALINGS IN THE SOFTWARE.
For more information, please refer to
*/
-/* pigpio version 61 */
+/* pigpio version 62 */
/* include ------------------------------------------------------- */
@@ -4395,6 +4395,8 @@ static void spiGoS(
SPI_CS_CSPOL(cspol) |
SPI_CS_CLEAR(3);
+ spiReg[SPI_DLEN] = 2; /* undocumented, stops inter-byte gap */
+
spiReg[SPI_CS] = spiDefaults; /* stop */
if (!count) return;
@@ -4925,6 +4927,8 @@ int serReadByte(unsigned handle)
int serWrite(unsigned handle, char *buf, unsigned count)
{
+ int written=0, wrote=0;
+
DBG(DBG_USER, "handle=%d count=%d [%s]",
handle, count, myBuf2Str(count, buf));
@@ -4939,7 +4943,19 @@ int serWrite(unsigned handle, char *buf, unsigned count)
if (!count)
SOFT_ERROR(PI_BAD_PARAM, "bad count (%d)", count);
- if (write(serInfo[handle].fd, buf, count) != count)
+ while ((written != count) && (wrote >= 0))
+ {
+ wrote = write(serInfo[handle].fd, buf+written, count-written);
+
+ if (wrote >= 0)
+ {
+ written += wrote;
+
+ if (written != count) time_sleep(0.05);
+ }
+ }
+
+ if (written != count)
return PI_SER_WRITE_FAILED;
else
return 0;
@@ -8703,6 +8719,8 @@ int gpioPWM(unsigned gpio, unsigned val)
switchFunctionOff(gpio);
gpioInfo[gpio].is = GPIO_PWM;
+
+ if (!val) myGpioWrite(gpio, 0);
}
myGpioSetMode(gpio, PI_OUTPUT);
@@ -8940,6 +8958,8 @@ int gpioServo(unsigned gpio, unsigned val)
switchFunctionOff(gpio);
gpioInfo[gpio].is = GPIO_SERVO;
+
+ if (!val) myGpioWrite(gpio, 0);
}
myGpioSetMode(gpio, PI_OUTPUT);
diff --git a/pigpio.h b/pigpio.h
index 57137c3..192006a 100644
--- a/pigpio.h
+++ b/pigpio.h
@@ -31,7 +31,7 @@ For more information, please refer to
#include
#include
-#define PIGPIO_VERSION 61
+#define PIGPIO_VERSION 62
/*TEXT
diff --git a/pigpiod_if.c b/pigpiod_if.c
index 3840968..4219a4f 100644
--- a/pigpiod_if.c
+++ b/pigpiod_if.c
@@ -25,7 +25,7 @@ OTHER DEALINGS IN THE SOFTWARE.
For more information, please refer to
*/
-/* PIGPIOD_IF_VERSION 25 */
+/* PIGPIOD_IF_VERSION 26 */
#include
#include
@@ -492,6 +492,11 @@ void stop_thread(pthread_t *pth)
int pigpio_start(char *addrStr, char *portStr)
{
+ if ((!addrStr) || (strlen(addrStr) == 0))
+ {
+ addrStr = "localhost";
+ }
+
if (!gPigStarted)
{
gPigCommand = pigpioOpenSocket(addrStr, portStr);
diff --git a/pigpiod_if.h b/pigpiod_if.h
index 6200a79..8714eab 100644
--- a/pigpiod_if.h
+++ b/pigpiod_if.h
@@ -30,7 +30,7 @@ For more information, please refer to
#include "pigpio.h"
-#define PIGPIOD_IF_VERSION 25
+#define PIGPIOD_IF_VERSION 26
/*TEXT
diff --git a/pigpiod_if2.c b/pigpiod_if2.c
index d94732a..86b779a 100644
--- a/pigpiod_if2.c
+++ b/pigpiod_if2.c
@@ -25,7 +25,7 @@ OTHER DEALINGS IN THE SOFTWARE.
For more information, please refer to
*/
-/* PIGPIOD_IF2_VERSION 9 */
+/* PIGPIOD_IF2_VERSION 10 */
#include
#include
@@ -713,6 +713,11 @@ int pigpio_start(char *addrStr, char *portStr)
int pi;
int *userdata;
+ if ((!addrStr) || (strlen(addrStr) == 0))
+ {
+ addrStr = "localhost";
+ }
+
for (pi=0; pi
#include "pigpio.h"
-#define PIGPIOD_IF2_VERSION 9
+#define PIGPIOD_IF2_VERSION 10
/*TEXT