11# SPDX-FileCopyrightText: 2022 Charlyn Gonda for Adafruit Industries
22#
33# SPDX-License-Identifier: MIT
4+ from secrets import secrets
5+ import ssl
46import busio
57import board
68import adafruit_lis3dh
79import wifi
8- import ssl
910import socketpool
1011import adafruit_requests
1112
1415from adafruit_io .adafruit_io import IO_HTTP
1516
1617from cube import Cube
17- from secrets import secrets
1818
1919# Specify pins
2020top_cin = board .A0
7474
7575
7676def update_data ():
77+ # pylint: disable=global-statement
7778 global CUBE_WORD , TOP_PIXELS_ON , TOP_PIXELS_COLOR
7879 if connected :
7980 print ("Updating data from Adafruit IO" )
@@ -88,8 +89,8 @@ def update_data():
8889 TOP_PIXELS_ON = pixels_list .split ("," )
8990 TOP_PIXELS_COLOR = TOP_PIXELS_COLOR_MAP [color ]
9091 # pylint: disable=broad-except
91- except Exception as error :
92- print (error )
92+ except Exception as update_error :
93+ print (update_error )
9394
9495
9596orientations = [
@@ -101,30 +102,31 @@ def update_data():
101102 "BACK"
102103]
103104
105+ # pylint: disable=inconsistent-return-statements
104106
105- def orientation (x , y , z ):
106- absX = abs (x )
107- absY = abs (y )
108- absZ = abs (z )
107+
108+ def orientation (curr_x , curr_y , curr_z ):
109+ absX = abs (curr_x )
110+ absY = abs (curr_y )
111+ absZ = abs (curr_z )
109112
110113 if absX > absY and absX > absZ :
111114 if x >= 0 :
112115 return orientations [1 ] # up
113- else :
114- return orientations [0 ] # down
116+
117+ return orientations [0 ] # down
115118
116119 if absZ > absY and absZ > absX : # when "down" is "up"
117120 if z >= 0 :
118121 return orientations [2 ] # left
119- else :
120- return orientations [3 ] # right
121- return orientations [2 ]
122+
123+ return orientations [3 ] # right
122124
123125 if absY > absX and absY > absZ :
124126 if y >= 0 :
125127 return orientations [4 ] # front
126- else :
127- return orientations [5 ] # back
128+
129+ return orientations [5 ] # back
128130
129131
130132upside_down = False
0 commit comments