implement gpio mapping for older revision pis
This commit is contained in:
parent
0d51a4bb49
commit
8d71c5953c
1 changed files with 21 additions and 21 deletions
|
@ -133,40 +133,40 @@ class LCD_HD44780(octoprint.plugin.StartupPlugin,
|
||||||
self._lcd_updating = False
|
self._lcd_updating = False
|
||||||
|
|
||||||
def _lcd_send_byte(self, bits, mode):
|
def _lcd_send_byte(self, bits, mode):
|
||||||
GPIO.output(self.pin_rs, mode)
|
GPIO.output(self._gpio_get_pin(self.pin_rs), mode)
|
||||||
GPIO.output(self.pin_d4, GPIO.LOW)
|
GPIO.output(self._gpio_get_pin(self.pin_d4), GPIO.LOW)
|
||||||
GPIO.output(self.pin_d5, GPIO.LOW)
|
GPIO.output(self._gpio_get_pin(self.pin_d5), GPIO.LOW)
|
||||||
GPIO.output(self.pin_d6, GPIO.LOW)
|
GPIO.output(self._gpio_get_pin(self.pin_d6), GPIO.LOW)
|
||||||
GPIO.output(self.pin_d7, GPIO.LOW)
|
GPIO.output(self._gpio_get_pin(self.pin_d7), GPIO.LOW)
|
||||||
if bits & 0x10 == 0x10:
|
if bits & 0x10 == 0x10:
|
||||||
GPIO.output(self.pin_d4, GPIO.HIGH)
|
GPIO.output(self._gpio_get_pin(self.pin_d4), GPIO.HIGH)
|
||||||
if bits & 0x20 == 0x20:
|
if bits & 0x20 == 0x20:
|
||||||
GPIO.output(self.pin_d5, GPIO.HIGH)
|
GPIO.output(self._gpio_get_pin(self.pin_d5), GPIO.HIGH)
|
||||||
if bits & 0x40 == 0x40:
|
if bits & 0x40 == 0x40:
|
||||||
GPIO.output(self.pin_d6, GPIO.HIGH)
|
GPIO.output(self._gpio_get_pin(self.pin_d6), GPIO.HIGH)
|
||||||
if bits & 0x80 == 0x80:
|
if bits & 0x80 == 0x80:
|
||||||
GPIO.output(self.pin_d7, GPIO.HIGH)
|
GPIO.output(self._gpio_get_pin(self.pin_d7), GPIO.HIGH)
|
||||||
time.sleep(self._lcd_delay)
|
time.sleep(self._lcd_delay)
|
||||||
GPIO.output(self.pin_e, GPIO.HIGH)
|
GPIO.output(self._gpio_get_pin(self.pin_e), GPIO.HIGH)
|
||||||
time.sleep(self._lcd_pulse)
|
time.sleep(self._lcd_pulse)
|
||||||
GPIO.output(self.pin_e, GPIO.LOW)
|
GPIO.output(self._gpio_get_pin(self.pin_e), GPIO.LOW)
|
||||||
time.sleep(self._lcd_delay)
|
time.sleep(self._lcd_delay)
|
||||||
GPIO.output(self.pin_d4, GPIO.LOW)
|
GPIO.output(self._gpio_get_pin(self.pin_d4), GPIO.LOW)
|
||||||
GPIO.output(self.pin_d5, GPIO.LOW)
|
GPIO.output(self._gpio_get_pin(self.pin_d5), GPIO.LOW)
|
||||||
GPIO.output(self.pin_d6, GPIO.LOW)
|
GPIO.output(self._gpio_get_pin(self.pin_d6), GPIO.LOW)
|
||||||
GPIO.output(self.pin_d7, GPIO.LOW)
|
GPIO.output(self._gpio_get_pin(self.pin_d7), GPIO.LOW)
|
||||||
if bits&0x01==0x01:
|
if bits&0x01==0x01:
|
||||||
GPIO.output(self.pin_d4, GPIO.HIGH)
|
GPIO.output(self._gpio_get_pin(self.pin_d4), GPIO.HIGH)
|
||||||
if bits&0x02==0x02:
|
if bits&0x02==0x02:
|
||||||
GPIO.output(self.pin_d5, GPIO.HIGH)
|
GPIO.output(self._gpio_get_pin(self.pin_d5), GPIO.HIGH)
|
||||||
if bits&0x04==0x04:
|
if bits&0x04==0x04:
|
||||||
GPIO.output(self.pin_d6, GPIO.HIGH)
|
GPIO.output(self._gpio_get_pin(self.pin_d6), GPIO.HIGH)
|
||||||
if bits&0x08==0x08:
|
if bits&0x08==0x08:
|
||||||
GPIO.output(self.pin_d7, GPIO.HIGH)
|
GPIO.output(self._gpio_get_pin(self.pin_d7), GPIO.HIGH)
|
||||||
time.sleep(self._lcd_delay)
|
time.sleep(self._lcd_delay)
|
||||||
GPIO.output(self.pin_e, GPIO.HIGH)
|
GPIO.output(self._gpio_get_pin(self.pin_e), GPIO.HIGH)
|
||||||
time.sleep(self._lcd_pulse)
|
time.sleep(self._lcd_pulse)
|
||||||
GPIO.output(self.pin_e, GPIO.LOW)
|
GPIO.output(self._gpio_get_pin(self.pin_e), GPIO.LOW)
|
||||||
time.sleep(self._lcd_delay)
|
time.sleep(self._lcd_delay)
|
||||||
|
|
||||||
def on_printer_add_temperature(self, data):
|
def on_printer_add_temperature(self, data):
|
||||||
|
|
Loading…
Reference in a new issue