diff --git a/lib/gt911_touch.py b/lib/gt911_touch.py index 7acb35c..d684d2f 100644 --- a/lib/gt911_touch.py +++ b/lib/gt911_touch.py @@ -186,7 +186,23 @@ def touches(self) -> List[dict]: return touchpoints def _reset(self, address, res_pin, irq_pin=None) -> None: - """ Initialize board - This sometimes fails, Ctrl-D reset to recover """ + """ + Initialize board to use default I2C address of 0x5D + + Some of the time, this function currently selects the + secondary I2C address (0x14). A ctrl-D reset immediatly + after the incorrect reset results in the correct I2C address + being selected. + + Alternatley the calling code can switch to the secondary + address if a device is not found on the primary address + + try: + self._i2c = I2CDevice(i2c, 0x5D) + except: + self._i2c = I2CDevice(i2c, 0x14) + """ + time.sleep(.0001) res_pin.direction = digitalio.Direction.OUTPUT res_pin.value = True diff --git a/lib/pydos_ui_virt.py b/lib/pydos_ui_virt.py index 620f6b9..cfc7098 100644 --- a/lib/pydos_ui_virt.py +++ b/lib/pydos_ui_virt.py @@ -83,23 +83,18 @@ def __init__(self): self._touched = False - #self._row1Keys = [600,555,510,465,420,375,330,285,240,195,150,105,60,0] self._row1Keys = [665,615,565,515,465,415,365,315,265,215,165,115,68,0] self._row1Letters = ['\x08','=','-','0','9','8','7','6','5','4','3','2','1','`'] self._row1Uppers = ['\x08','+','_',')','(','*','&','^','%','$','#','@','!','~'] - #self._row2Keys = [615,570,525,485,440,395,350,305,260,215,175,130,80,0] self._row2Keys = [695,645,595,545,495,445,395,345,295,245,195,145,95,0] self._row2Letters = ['\\',']','[','p','o','i','u','y','t','r','e','w','q','\x09'] self._row2Uppers = ['|','}','{'] - #self._row3Keys = [590,545,500,455,410,365,320,275,230,185,140,95,0] self._row3Keys = [650,600,550,500,450,400,350,300,250,200,150,100,0] self._row3Letters = ['\n',"'",';','l','k','j','h','g','f','d','s',"a",'C'] self._row3Uppers = ['\n','"',':'] - #self._row4Keys = [565,520,475,430,385,340,295,250,205,160,115,0] self._row4Keys = [635,585,535,485,435,385,335,285,235,185,135,0] self._row4Letters = ['S','/','.',',','m','n','b','v','c','x','z','S'] self._row4Uppers = ['S','?','>','<'] - #self._row5Keys = [640,460,200,110,0] self._row5Keys = [710,520,220,125,0] self._row5Letters = ['X','',' ','','\x1b']