diff --git a/e32_client/e32.py b/e32_client/e32.py index bb90bbb..efe1808 100755 --- a/e32_client/e32.py +++ b/e32_client/e32.py @@ -43,7 +43,7 @@ TX_POWER_TABLE = { } -def __least_gte(value, dic): +def least_gte(value, dic): items = sorted(dic.items(), key=lambda item: item[1]) last_k = None for k, v in items: @@ -117,15 +117,15 @@ class E32_Params: datab[2] = (p.address) & 0xFF datab[3] = 0 datab[3] |= p.parity << 6 - datab[3] |= (__least_gte(p.baud, BAUD_TABLE) << 3) - datab[3] |= (__least_gte(p.air_data_rate, AIR_DATA_RATE_TABLE)) + datab[3] |= (least_gte(p.baud, BAUD_TABLE) << 3) + datab[3] |= (least_gte(p.air_data_rate, AIR_DATA_RATE_TABLE)) datab[4] = p.channel datab[5] = 0 datab[5] |= p.tx_mode << 7 datab[5] |= p.io_mode << 6 datab[5] |= (int((p.wake_up_time / 250) - 1) & 0b111) << 3 datab[5] |= p.fec_enabled << 2 - datab[5] |= __least_gte(p.tx_power, TX_POWER_TABLE) + datab[5] |= least_gte(p.tx_power, TX_POWER_TABLE) return datab