From c664642c3a856cc6ab9a583b312610c429f484a5 Mon Sep 17 00:00:00 2001 From: merspieler Date: Thu, 22 Feb 2018 21:37:17 +0100 Subject: [PATCH] Added function and a bug fix Signed-off-by: merspieler --- __init__.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/__init__.py b/__init__.py index f14f9bd..0262ed1 100644 --- a/__init__.py +++ b/__init__.py @@ -156,6 +156,8 @@ class FlightGearCopilotSkill(MycroftSkill): else: self.speak("Speed checked.") + flaps_request = int(flaps_request) + if flaps_mov == "extend": pos_reached = 0 while pos_reached == 0: @@ -896,6 +898,20 @@ class FlightGearCopilotSkill(MycroftSkill): tn.read_until("\n") return ret[:-1] + # count number of items in a prop tree dir + def get_item_count(self, tn, directory): + tn.write("ls " + directory + "\r\n") + ret = 0 + result = " " + + while result != "": + result = tn.read_until("\n", 1) + ret = ret + 1 + + ret = ret - 1 + tn.write("cd /\r\n") + return ret + # exit routine to properly close the tn con def exit(self, tn): tn.close