So maybe its because I don’t understand python indentation system or I can blame it on pythonWin being HORRIBLE as an IDE. I am working with a telit device and can’t get the debug stuff to work. Just gives me errors and besides I need my serial port to talk to my device not my computer. I get most of my code to work fine but whenever I add another if statement or another big section of code it takes me 2 days of debuging before it runs right and I usually don’t change anything for instance.
if (a != -1):
MOD.watchdogEnable(75)
firstdigit_pos = a + 12
pos = res[firstdigit_pos:-2]
SMSnumber = getSMSnumber(pos)
SMSmessage = getSMSmessage(pos)
SMSmessage = SMSmessage.lower()
eb = SMSmessage.find('eb')
sl = SMSmessage.find('sl')
re = SMSmessage.find('re')
nf = SMSmessage.find('nf')
st = -1
st = SMSmessage.find('st')
del_all_SMS(pos)
a = -1
if (eb != -1):
b = -1
c = SMSmessage.find(' ')
pw = SMSmessage[0:c]
i = 0
while (b != 1):
b = ABR_login(pw)
i = i + 1
if (i > 4):
e = 'Login Error'
break
elif (b == 1):
e = get_EB()
SER.send('BY\r')
sendSMS(SMSnumber, e)
eb = -1
b = -1
MOD.watchdogDisable()
if (sl != -1):
b = -1
c = SMSmessage.rfind(' ')
pw = SMSmessage[0:c]
i = 0
while (b != 1):
b = ABR_login(pw)
i = i + 1
if (i > 4):
e = 'Login Error'
break
elif (b == 1):
e = get_SL()
SER.send('BY\r')
sendSMS(SMSnumber, e)
sl = -1
b = -1
MOD.watchdogDisable()
if (re != -1):
b = -1
c = SMSmessage.rfind(' ')
pw = SMSmessage[0:c]
i = 0
while (b != 1):
b = ABR_login(pw)
i = i + 1
if (i > 4):
e = 'Login Error'
break
elif (b == 1):
e = ABR_soft_reset()
SER.send('BY\r')
sendSMS(SMSnumber, e)
re = -1
b = -1
MOD.watchdogDisable()
if (nf != -1):
b = -1
c = SMSmessage.rfind(' ')
pw = SMSmessage[0:c]
i = 0
while (b != 1):
b = ABR_login(pw)
i = i + 1
if (i > 4):
e = 'Login Error'
break
elif (b == 1):
e = get_NF()
SER.send('BY\r')
sendSMS(SMSnumber, e)
nf = -1
b = -1
MOD.watchdogDisable()
if (st != 1):
b = -1
c = SMSmessage.rfind(' ')
pw = SMSmessage[0:c]
i = 0
while (b != 1):
b = ABR_login(pw)
i = i + 1
if ( i > 4):
e = 'Login Error'
break
elif ( b == 1):
j = get_EB()
k = get_SL()
l = get_NF()
e = j + '\r\n' + k + '\r\n' + l
SER.send('BY\r')
sendSMS(SMSnumber, e)
st = -1
b= -1
MOD.watchdogDisable()
Works great besides the last if statement I just added ALWAYS runs. Then I indented more then the rest and it never runs now. Am I missing something?
the a check works great. That indicates an sms message was received. Then the eb check is done if the command eb is issued same with the others. however all the others besides st return their set of data plus it runs through and sends the ST command as well. I’m totally lost