mirror of
https://github.com/cyberboy666/r_e_c_u_r.git
synced 2025-12-10 18:30:05 +01:00
fixed a few small bugs and only read analog inputs if there is a change
This commit is contained in:
@@ -113,7 +113,7 @@ class BrowserMenu(Menu):
|
|||||||
|
|
||||||
for f in files:
|
for f in files:
|
||||||
split_name = os.path.splitext(f)
|
split_name = os.path.splitext(f)
|
||||||
if (split_name[1] in ['.mp4', '.mkv', '.avi', '.mov']):
|
if (split_name[1].lower() in ['.mp4', '.mkv', '.avi', '.mov']):
|
||||||
self.menu_list.append(dict(name='{}{}'.format(indent, f), slot='-'))
|
self.menu_list.append(dict(name='{}{}'.format(indent, f), slot='-'))
|
||||||
|
|
||||||
def _is_file_in_bank_data(self, file_name):
|
def _is_file_in_bank_data(self, file_name):
|
||||||
|
|||||||
@@ -9,8 +9,8 @@ class AnalogInput(object):
|
|||||||
self.actions = actions
|
self.actions = actions
|
||||||
self.data = data
|
self.data = data
|
||||||
self.analog_mappings = data.analog_mappings
|
self.analog_mappings = data.analog_mappings
|
||||||
self.midi_device = None
|
|
||||||
self.analog_delay = 50
|
self.analog_delay = 50
|
||||||
|
self.last_readings = [0,0,0,0,0,0,0,0]
|
||||||
|
|
||||||
SPI_PORT = 1
|
SPI_PORT = 1
|
||||||
SPI_DEVICE = 2
|
SPI_DEVICE = 2
|
||||||
@@ -26,11 +26,12 @@ class AnalogInput(object):
|
|||||||
|
|
||||||
def poll_analog_inputs(self):
|
def poll_analog_inputs(self):
|
||||||
if self.data.settings['other']['ANALOG_INPUT']['value'] == 'enabled':
|
if self.data.settings['other']['ANALOG_INPUT']['value'] == 'enabled':
|
||||||
for i in range(0,8):
|
for i in range(0,8):
|
||||||
if str(i) in self.analog_mappings:
|
if str(i) in self.analog_mappings:
|
||||||
print('{} is in the mapping'.format(i))
|
this_reading = self.analog_input.read_adc(i)
|
||||||
reading = self.analog_input.read_adc(i)
|
if this_reading - self.last_readings[i] > 3:
|
||||||
self.run_action_for_mapped_channel(i, reading)
|
self.run_action_for_mapped_channel(i, this_reading)
|
||||||
|
self.last_readings[i] = this_reading
|
||||||
self.root.after(self.analog_delay, self.poll_analog_inputs)
|
self.root.after(self.analog_delay, self.poll_analog_inputs)
|
||||||
else:
|
else:
|
||||||
self.check_if_listening_enabled()
|
self.check_if_listening_enabled()
|
||||||
|
|||||||
@@ -36,8 +36,8 @@ class MidiInput(object):
|
|||||||
for message in self.midi_device.iter_pending():
|
for message in self.midi_device.iter_pending():
|
||||||
i = i + 1
|
i = i + 1
|
||||||
message_dict = message.dict()
|
message_dict = message.dict()
|
||||||
## only listening to midi channel 1 for now , will make it seletcable later
|
midi_channel = midi_setting = self.data.settings['midi']['CHANNEL']['value'] - 1
|
||||||
if not message_dict['channel'] == 0:
|
if not message_dict['channel'] == midi_channel:
|
||||||
pass
|
pass
|
||||||
## turning off noisey clock messages for now - may want to use them at some point
|
## turning off noisey clock messages for now - may want to use them at some point
|
||||||
elif message_dict['type'] == 'clock':
|
elif message_dict['type'] == 'clock':
|
||||||
|
|||||||
Reference in New Issue
Block a user