Skip to content

Commit

Permalink
Update main.py
Browse files Browse the repository at this point in the history
  • Loading branch information
thiagohersan authored Feb 25, 2024
1 parent 48bdde1 commit 3709e7a
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions firmware/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,9 @@ def pmap(x, in_min, in_max, out_min, out_max):
return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min

def cropmap(x, in_min, in_max, out_min, out_max):
ress = 0
if x>=in_min and x<=in_max:
ress = (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min
elif x<in_min:
ress = 0
ress = (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min
if x < in_min:
ress = out_min
elif x>in_max:
ress = out_max
return ress
Expand Down Expand Up @@ -277,4 +275,4 @@ def sms_handler(evt):



#assert rsp == b'HTTP/1.1 200 OK\r\ncontent-length: 0\r\n\r\n'
#assert rsp == b'HTTP/1.1 200 OK\r\ncontent-length: 0\r\n\r\n'

0 comments on commit 3709e7a

Please sign in to comment.