# HG changeset patch
# User jfp <jf.pieronne@laposte.net>
# Date 1737047709 -3600
#      Thu Jan 16 18:15:09 2025 +0100
# Node ID 81352acd5b36d33a5b14a4558cbd96fee4f99ed0
# Parent  a39600d0b52cc74c8e0b9c5eb9022096b609313f
Temporary, dont't check IOSB status if is zero

diff --git a/python/local/ovms_module/ovms/itemList/_itemList.pyx b/python/local/ovms_module/ovms/itemList/_itemList.pyx
--- a/python/local/ovms_module/ovms/itemList/_itemList.pyx
+++ b/python/local/ovms_module/ovms/itemList/_itemList.pyx
@@ -41,6 +41,10 @@
     [type ItemList_Type, object ItemListObject] :
     def __init__(self, unsigned short code=0, value=None, int dtype=noType, 
                  unsigned short length=0, unsigned int flags=0):
+        if value is True and dtype == noType:
+            dtype = booleanType
+        if isinstance(value, str):
+            value = value.encode("iso-8859-15")
         if dtype == noType and isinstance(value, bytes):
             dtype = stringType
         if dtype == noType and value is None:
@@ -55,8 +59,11 @@
                 raise error('arrayUnsignedLong: not matching sequence length')
         if dtype == signedLongByValueType and value is None:
             raise error('signedLongByValue: missing value')
-        if dtype == booleanType:
-            pass
+        if dtype == booleanType:  
+            if value is None:
+                value = True
+            elif value is not True:
+                raise error("boolean value should be True or None (same as True)")
         elif dtype == lkiDefListType:
             if value is not None:
                 raise error("Should not specified a value with lkiDefListType")
@@ -306,10 +313,8 @@
     cdef LKIDEF* lkiptr = NULL
     for i from 0 <= i < itmcard:
         itm = itmlst[i]
-        if itm.value is None: # output argument
-            if itm.dtype == booleanType:
-                pass
-            elif itm.dtype == signedByteType:
+        if itm.value is None: # output argument, can't be boolean type
+            if itm.dtype == signedByteType:
                 val = int((<char *>pile3.ile3_ps_bufaddr)[0])
             elif itm.dtype == unsignedByteType:
                 val = int((<unsigned char *>pile3.ile3_ps_bufaddr)[0])
diff --git a/python/local/ovms_module/ovms/ptd/_vmsptd.pyx b/python/local/ovms_module/ovms/ptd/_vmsptd.pyx
--- a/python/local/ovms_module/ovms/ptd/_vmsptd.pyx
+++ b/python/local/ovms_module/ovms/ptd/_vmsptd.pyx
@@ -420,7 +420,8 @@
                       handler.handler.buflen - 1024 - 4)
     checkStatus(s)
     s = (<unsigned short *>(handler.handler.inadr.va_range_ps_start_va))[0]
-    checkStatus(s)
+    if s != 0:
+        checkStatus(s)
     cdef char* buf = <char *>(handler.handler.inadr.va_range_ps_start_va) + 4
     cdef unsigned short* retlenPtr = <unsigned short *>(buf - 2)
     return s, buf[:retlenPtr[0]]