Skip to content

Commit 6fb3463

Browse files
committed
Bug fix for Craft, Ring, Hex
1 parent d571296 commit 6fb3463

1 file changed

Lines changed: 19 additions & 4 deletions

File tree

trill.py

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939

4040
TYPES = ["Unknown", "Bar", "Square", "Craft", "Ring", "Hex", "Flex"]
4141

42-
# Class that represents a generic Trill device
42+
# Class that represents a generic Trill sensor
4343
class TrillSensor(object):
4444

4545
# Initialize a generic Trill sensor, with
@@ -224,13 +224,19 @@ def read(self):
224224

225225

226226
# Class representing a Trill Craft
227-
class Craft(Bar):
227+
class Craft(TrillSensor):
228228

229229
def __init__(self, i2c, address=0x30, mode=MODE_CENTROID, sleep=10):
230230
super(Craft, self).__init__(i2c, address, mode, sleep)
231231
self.type = 3
232232
self.size = (1, 4096)
233233
self.channels = 30
234+
self.maxTouches = 5
235+
self.directions = 1
236+
237+
self.setMode(mode)
238+
self.setScanSettings()
239+
self.updateBaseline()
234240

235241
def read(self):
236242
super(Craft, self).read()
@@ -245,13 +251,19 @@ def read(self):
245251

246252

247253
# Class representing a Trill Ring
248-
class Ring(Bar):
254+
class Ring(TrillSensor):
249255

250256
def __init__(self, i2c, address=0x38, mode=MODE_CENTROID, sleep=10):
251257
super(Ring, self).__init__(i2c, address, mode, sleep)
252258
self.type = 4
253259
self.size = (1, 3584)
254260
self.channels = 28
261+
self.maxTouches = 5
262+
self.directions = 1
263+
264+
self.setMode(mode)
265+
self.setScanSettings()
266+
self.updateBaseline()
255267

256268
def read(self):
257269
super(Ring, self).read()
@@ -266,12 +278,15 @@ def read(self):
266278

267279

268280
# Class representing a Trill Hex
269-
class Hex(Square):
281+
class Hex(TrillSensor):
270282

271283
def __init__(self, i2c, address=0x40, mode=MODE_CENTROID, sleep=10):
272284
super(Hex, self).__init__(i2c, address, mode, sleep)
273285
self.type = 5
274286
self.size = (1664, 1920)
287+
self.channels = 30
288+
self.maxTouches = 4
289+
self.directions = 2
275290

276291
self.setMode(mode)
277292
self.setScanSettings()

0 commit comments

Comments
 (0)