Finish "test servo mappings" basic function

This commit is contained in:
Mike 2021-07-08 12:19:19 +01:00
parent 7b8eab18ab
commit 17f8ec000b

View File

@ -142,9 +142,7 @@ class MikesServoMapper:
else: else:
self.__logger.warning("Invalid choice: %s" % user_choice) self.__logger.warning("Invalid choice: %s" % user_choice)
def edit_mappings(self): def get_servo_kit(self):
self.__logger.info("Begin mapping mode !")
i2c_address = self.determine_i2c_address() i2c_address = self.determine_i2c_address()
servo_kit = ServoKit( servo_kit = ServoKit(
@ -152,6 +150,15 @@ class MikesServoMapper:
channels=self.__CHANNELS_COUNT channels=self.__CHANNELS_COUNT
) )
return servo_kit
def edit_mappings(self):
self.__logger.info("Begin mapping mode !")
#
servo_kit = self.get_servo_kit()
# #
while True: while True:
@ -227,12 +234,15 @@ class MikesServoMapper:
self.__logger.info("Testing mappings!") self.__logger.info("Testing mappings!")
#
servo_kit = self.get_servo_kit()
#
for name in self.__mappings.keys(): for name in self.__mappings.keys():
channel = self.get_name_mapping(name=name) channel = self.get_name_mapping(name=name)
self.__logger.info("Jiggling mapping: %s ==> %s" % (name, channel)) self.__logger.info("Jiggling mapping: %s ==> %s" % (name, channel))
self.jiggle_channel(servo_kit=servo_kit, channel=channel)
time.sleep(1)
self.__logger.info("Done testing mappings") self.__logger.info("Done testing mappings")