2 Commits 63d0896c2c ... 91b52dcf97

Autor SHA1 Mensagem Data
  Min 91b52dcf97 fixed wx float warning 3 anos atrás
  Min 8b7ec93720 python 3.9+ fix 3 anos atrás
2 arquivos alterados com 6 adições e 8 exclusões
  1. 4 6
      emulator/python/py_interface.c
  2. 2 2
      msp430emu/emulator.py

+ 4 - 6
emulator/python/py_interface.c

@@ -18,11 +18,10 @@ static PyObject *method_start(PyObject *self, PyObject *args) {
 
 static PyObject *method_cmd(PyObject *self, PyObject *args) {
     char *cmd;
-    int len;
-    if(!PyArg_ParseTuple(args, "s#", &cmd, &len)) {
+    if(!PyArg_ParseTuple(args, "s", &cmd)) {
         return NULL;
     }
-    cmd_emu(cmd, len);
+    cmd_emu(cmd, strlen(cmd));
     return Py_None;
 }
 
@@ -130,12 +129,11 @@ static PyObject *method_on_control(PyObject *self, PyObject *args) {
 
 static PyObject *method_write_serial(PyObject *self, PyObject *args) {
     char *cmd;
-    int len;
-    if(!PyArg_ParseTuple(args, "s#", &cmd, &len)) {
+    if(!PyArg_ParseTuple(args, "s", &cmd)) {
         return NULL;
     }
     Py_BEGIN_ALLOW_THREADS
-    write_serial(cmd, len);
+    write_serial(cmd, strlen(cmd));
     Py_END_ALLOW_THREADS
     return Py_None;
 }

+ 2 - 2
msp430emu/emulator.py

@@ -626,8 +626,8 @@ class DrawRect(wx.Panel):
     def hsv_to_rgb(h, s, v):
         i = int(h * 6.)
         f = (h * 6.) - i
-        v *= 255
-        p, q, t = v * (1. - s), v * (1. - s * f), v * (1. - s * (1. - f))
+        v = int(v) * 255
+        p, q, t = int(v * (1. - s)), int(v * (1. - s * f)), int(v * (1. - s * (1. - f)))
         i %= 6
         if i == 0:
             return v, t, p