Permalink
Browse files

added 0xb0 modes for offscreen buffer mods

  • Loading branch information...
1 parent 763f8f8 commit 363e212dffac3684f3b03e1837f99da3ca154e63 @phooky phooky committed May 6, 2013
Showing with 29 additions and 0 deletions.
  1. +26 −0 hexascroller/hexascroller.ino
  2. +3 −0 hexaservice/jsonsock.py
@@ -64,6 +64,20 @@
// Payload:
// V - 1 byte indicating on (non-zero) or off (zero)
// Response payload: None
+//
+// Commands from 0xB0+ operate on the offscreen buffer level
+// 0xB0 - Clear offscreen buffer
+// Payload: None
+// Response payload: None
+// 0xB1 - add text
+// Payload:
+// X - 1 byte signed x offset
+// Y - 1 byte signed y offset
+// s... - string to display
+// Response payload: None
+// 0xB2 - Display offscreen buffer
+// Payload: None
+// Response payload: None
//
#define COMM_PORT Serial
@@ -306,6 +320,18 @@ void loop() {
}
if (curCmd != 0 && cmdIdx == cmdLen) {
switch(curCmd) {
+ case 0xB0: // clear buffer
+ b.erase();
+ succeed();
+ break;
+ case 0xB1: // add text
+ b.writeNStr(command+2,cmdLen-2,command[0],command[1]);
+ succeed();
+ break;
+ case 0xB2: // flip
+ b.flip();
+ succeed();
+ break;
case 0xA1: // text
b.erase();
b.writeNStr(command+2,cmdLen-2,command[0],command[1]);
@@ -1,6 +1,7 @@
import socket
import json
import threading
+import logging
HEXAPORT=1214 # it's the Kazaa port! :)
@@ -14,8 +15,10 @@ def __init__(self):
def run(self):
while True:
(conn, addr) = self.sock.accept()
+ logging.info("Connection from {0}".format(addr))
print(conn,addr)
if __name__=="__main__":
+ logging.basicConfig(filename="hexa.log",level=logging.INFO)
l = Listener()
l.start()

0 comments on commit 363e212

Please sign in to comment.