def set_channel(chan): print("set_channel:",chan) mesh.command("set_channel",[chan]) loop(2) mesh.command("get_channel",[]) loop(2) return
def set_retries(retries,delay): print("set_retries:") mesh.command("cfg_retries",[retries]) loop(2) print("config_ack_delay:") mesh.command("cfg_ack_delay",[0,delay]) loop(2) return
def test_channel(target,channel,nb_ping=100): """ Tests the RF connection between the 'hci' node and another 'target' node sends a single serial request with : - 'target' : the node that will receive the pings and sends back ack - 'channel' : frequency channel, from 0 (2.4 GHz) till 125 (2.525 GHz) - 'nb_ping' : usually 100 for a significant signal quality estimation """ set_rx("msg",1) set_rx("bcast",0) set_rx("resp",1) print("RF Test O->%d, Chan %d" % (target,channel)) mesh.command("test_rf",[target,channel,nb_ping]) loop(20) return
def set_rx(func,val): print("set_rx:",func,val) mesh.command("set_rx",[mesh.set_rx[func],val]) loop(2) return
def get_channel(): mesh.command("get_channel",[]) loop(2) return
def get_mode(): print("get_mode:") mesh.command("get_mode") loop(2) return
def set_mode(mode_txt): print("set_mode:",mode_txt) mesh.command("set_mode",[mesh.mode[mode_txt]]) loop(2) return
def writereg(reg,val): print("write in reg 0x%02X val:%u"%(reg,val)) mesh.command("writereg",[reg,val]) loop(2) return
def readreg(reg): mesh.command("readreg",[reg]) loop(2) return