20160422_jeffrey - silenceuncrio/diary GitHub Wiki
Index
0850
linkit 與 csr 之間的溝通需要修改
linkit 發給 csr 的 request 除了 header 之外還要能帶 payload
1015
改好囉
可以來實作 delay 了
先把介面做好
1400
delay 會動囉
不過 plug 具體的 delay 行為是這樣的
bpoint 給的描述如下
Set Plug delay command: “ATC” + ”A” + High byte of time + low byte of time + checksum.
time = 延遲幾分鐘
時 間單位為分鐘
我們以延遲一分鐘當作例子
command 下達給 plug 後
延遲一分鐘
會發生甚麼事?
on? off?
答案是 off
所以下 command 的當下
如果 plug 是 off 的話
完全看不出延遲的效果
一定要是 on 才行
至於 checksum 更搞笑
就把 checksum 之前的每個 byte 相加就好了
也不用煩惱 溢位 的問題
來把 code 寫一寫吧
1520
我們以延遲十分鐘當作例子
command 下達給 plug 後
延遲十分鐘後會發生 off
那在這十分鐘內呢?
我要怎麼知道這個 plug 是處於 等著 十分鐘後會發生 off
的狀態
bpoint 提供的 command 如下
you can get current status of plug by sending query command.
the query command format as below
ATC + Q + 0x00 + 0x00 + checksum
while writing the command, you should receive a notification from plug.
Now, you get the on/off status.
繼續實作吧...