Fixes for not splitting python list correctly.

This commit is contained in:
Patrick McDonagh
2018-01-30 22:32:59 -06:00
parent 0da6adc3e0
commit 35827323a4
5 changed files with 2078 additions and 907 deletions

View File

@@ -7,6 +7,6 @@
},
"deviceName": "prostarsolar",
"driverId": "0170",
"releaseVersion": "2",
"releaseVersion": "3",
"driverFileName": "prostarsolar.py"
}

View File

@@ -7,6 +7,6 @@
"persistence.py",
"modbusMap.p"
],
"version": 2,
"version": 3,
"s3BucketName": "prostarsolar"
}

File diff suppressed because it is too large Load Diff

View File

@@ -36,7 +36,7 @@ def pad(string_to_pad, char_to_pad_with, num_chars):
def split_into_parts(inp_str):
"""Split the binary string."""
return inp_str[0:1] + " " + inp_str[1:6] + " " + inp_str[7:15]
return inp_str[0:1] + " " + inp_str[1:6] + " " + inp_str[6:17]
for t in test_values:

View File

@@ -18,10 +18,10 @@ def int_to_float16(int_to_convert):
if int(bin_rep[0]) == 1:
sign = -1.0
exponent = float(int(bin_rep[1:6], 2))
if exponent == 30:
fraction = float(int("1" + bin_rep[7:17], 2))
else:
fraction = float(int(bin_rep[7:17], 2))
# if exponent == 30:
# fraction = float(int("1" + bin_rep[:17], 2))
# else:
fraction = float(int(bin_rep[6:17], 2))
if exponent == float(0b00000):
return sign * 2 ** -14 * fraction / (2.0 ** 10.0)