@@ -5,8 +5,7 @@ from pydrk import serial
context = zmq.Context()
socket = context.socket(zmq.REQ)
#self.socket.setsockopt(zmq.IPV6, True)
-#socket.connect(f"tcp://127.0.0.1:9484")
-socket.connect(f"tcp://192.168.1.20:9484")
+socket.connect(f"tcp://127.0.0.1:9484")
req_cmd = bytearray()
serial.write_u8(req_cmd, 0)
@@ -2,7 +2,7 @@ from collections import namedtuple
from pydrk import Api, HostApi, PropertyType, PropertySubType, Property, serial
import zmq
-api = Api(addr="192.168.1.20")
+api = Api()
host = HostApi(api)
print("Node status:", api.hello())
@@ -20,12 +20,24 @@ pub fn ansi_texture(width: usize, height: usize, data: &Vec<u8>) -> String {
let b = (data[idx + 2] as f32) / 255.;
let a = (data[idx + 3] as f32) / 255.;
- let r = (a * r * 255.) as u8;
- let g = (a * g * 255.) as u8;
- let b = (a * b * 255.) as u8;
-
- let val = "█".truecolor(r, g, b).to_string();
- out.push_str(&val);
+ #[cfg(target_os = "android")]
+ {
+ if a > 0. {
+ out.push('█');
+ } else {
+ out.push(' ');
+ }
+
+ #[cfg(target_os = "linux")]
+ let r = (a * r * 255.) as u8;
+ let g = (a * g * 255.) as u8;
+ let b = (a * b * 255.) as u8;
+ let val = "█".truecolor(r, g, b).to_string();
+ out.push_str(&val);
}
out.push('│');
out.push('\n');