Skip to content

Commit

Permalink
Fix line continue characters
Browse files Browse the repository at this point in the history
  • Loading branch information
stuartpittaway committed Mar 28, 2017
1 parent 03a8659 commit dde21e8
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 12 deletions.
16 changes: 8 additions & 8 deletions src/smalibrary/SMANET2PlusPacket.py
Expand Up @@ -95,14 +95,14 @@ def getFourByteLong(self, offset):
return long(value);

def getEightByte(self, offset):
return self.packet[offset] * math.pow(256, 0)
+ self.packet[offset + 1] * math.pow(256, 1)
+ self.packet[offset + 2] * math.pow(256, 2)
+ self.packet[offset + 3] * math.pow(256, 3)
+ self.packet[offset + 4] * math.pow(256, 4)
+ self.packet[offset + 5] * math.pow(256, 5)
+ self.packet[offset + 6] * math.pow(256, 6)
+ self.packet[offset + 7] * math.pow(256, 7)
return self.packet[offset] * math.pow(256, 0) \
+ self.packet[offset + 1] * math.pow(256, 1) \
+ self.packet[offset + 2] * math.pow(256, 2) \
+ self.packet[offset + 3] * math.pow(256, 3) \
+ self.packet[offset + 4] * math.pow(256, 4) \
+ self.packet[offset + 5] * math.pow(256, 5) \
+ self.packet[offset + 6] * math.pow(256, 6) \
+ self.packet[offset + 7] * math.pow(256, 7)

def getArray(self):
return self.packet
Expand Down
11 changes: 7 additions & 4 deletions src/smalibrary/SMASolar_library.py
Expand Up @@ -208,7 +208,7 @@ def getInverterDetails(btSocket, packet_send_counter, mylocalBTAddress, MySerial
def logon(btSocket,mylocalBTAddress,MySerialNumber,packet_send_counter, InverterPasswordArray):
# Logon to inverter
pluspacket1 = SMANET2PlusPacket(0x0e, 0xa0, packet_send_counter, MySerialNumber, 0x00, 0x01, 0x01)
pluspacket1.pushLong(0xFFFD040c)
pluspacket1.pushLong(0xFFFD040C)
#0x07 = User logon, 0x0a = installer logon
pluspacket1.pushLong(0x00000007)
#Timeout = 900sec ?
Expand All @@ -219,6 +219,7 @@ def logon(btSocket,mylocalBTAddress,MySerialNumber,packet_send_counter, Inverter
pluspacket1.pushLong(0x00000000)
pluspacket1.pushByteArray(InverterPasswordArray)

#Broadcast logon to all inverters
send = SMABluetoothPacket(0x01, 0x01, 0x00, 0x01, 0x00, mylocalBTAddress)
send.pushRawByteArray(pluspacket1.getBytesForSending())
send.finish()
Expand Down Expand Up @@ -362,8 +363,8 @@ def extract_data(level2Packet):

spotvaluelist[0x2601] = SpotValue("TotalYield",1, 16) #8 byte word
spotvaluelist[0x2622] = SpotValue("DayYield",1, 16) #8 byte word
spotvaluelist[0x462f] = SpotValue("FeedInTime",3600, 16)#8 byte word
spotvaluelist[0x462e] = SpotValue("OperatingTime",3600, 16)#8 byte word
spotvaluelist[0x462f] = SpotValue("FeedInTime",1, 16)#8 byte word
spotvaluelist[0x462e] = SpotValue("OperatingTime",1, 16)#8 byte word

spotvaluelist[0x251e] = SpotValue("DCPower1",1, 28)
spotvaluelist[0x451f] = SpotValue("DCVoltage1",100, 28)
Expand Down Expand Up @@ -402,6 +403,7 @@ def extract_data(level2Packet):
if (value == 0x8000) or (value == 0xFFFF):
value = 0;


if readingtype in spotvaluelist:
v = spotvaluelist[readingtype]

Expand All @@ -412,6 +414,8 @@ def extract_data(level2Packet):
value = 0;




# Special case for DC voltage input (aka SPOT_UDC1 / SPOT_UDC2)
#if (readingtype==0x451f):
# if (classtype==1):
Expand All @@ -422,7 +426,6 @@ def extract_data(level2Packet):
# outputlist[v.Description] = SpotValueOutput(v.Description, float(value) / float(v.Scale))

outputlist[v.Description] = SpotValueOutput(v.Description, round( float(value) / float(v.Scale) ,4) )

offset+=v.RecSize

else:
Expand Down

0 comments on commit dde21e8

Please sign in to comment.