-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add initial protobuf and BLE functionality
- Loading branch information
1 parent
1f9acc6
commit 80ff770
Showing
4 changed files
with
570 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
*_pb2.py | ||
__pycache__ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
#!/usr/bin/env python3 | ||
|
||
import asyncio | ||
from libikawa import * | ||
|
||
async def main(): | ||
async with Ikawa() as ikawa: | ||
cmd = Cmd(cmd_type=BOOTLOADER_GET_VERSION) | ||
resp = await ikawa.send_cmd(cmd) | ||
print(resp) | ||
cmd = Cmd(cmd_type=MACH_PROP_GET_TYPE) | ||
resp = await ikawa.send_cmd(cmd) | ||
print(resp) | ||
cmd = Cmd(cmd_type=PROFILE_GET) | ||
resp = await ikawa.send_cmd(cmd) | ||
print(resp) | ||
|
||
print("enumerating settings...") | ||
settings=dict() | ||
cmd = Cmd(cmd_type=SETTING_GET_LIST, setting_get_list=CmdSettingGetList(offset=0)) | ||
resp = await ikawa.send_cmd(cmd) | ||
# print(resp) | ||
for i in resp.resp_setting_get_list.number: | ||
cmd = Cmd(cmd_type=SETTING_GET_INFO, setting_get_info=CmdSettingGetInfo(number=i)) | ||
resp = await ikawa.send_cmd(cmd) | ||
# print(resp) | ||
settings[resp.resp_setting_get_info.name] = i | ||
print(f"settings={settings}\n") | ||
|
||
cmd = Cmd(cmd_type=SETTING_GET, setting_get=CmdSettingGet(number=settings['ROASTER_ID'])) | ||
resp = await ikawa.send_cmd(cmd) | ||
print(resp) | ||
|
||
while True: | ||
cmd = Cmd(cmd_type=MACH_STATUS_GET_ALL) | ||
resp = await ikawa.send_cmd(cmd) | ||
status = resp.resp_mach_status_get_all | ||
print(f"{status.time}, {MachState.Name(status.state)}, {status.temp_above*0.1:.1f}, {status.temp_below*0.1:.1f}, {status.setpoint*0.1:.1f}, {status.heater}, {status.fan/255.0:.2f}, {(status.fan_measured/12.0)*60:.0f}") | ||
await asyncio.sleep(0.1) | ||
|
||
try: | ||
asyncio.run(main()) | ||
except KeyboardInterrupt: | ||
print("Received interrupt signal, bye") |
Oops, something went wrong.