h-akanuma / M5StackAvatarPython

M5Stack Python avatar module
2 stars 1 forks source link

Error using current UiFlow Micropython #1

Open COVID-19-CTI opened 2 years ago

COVID-19-CTI commented 2 years ago

UiFlow Micropython 1.10.9 on a M5stack Core2, using VSCode to edit and transfer files.

Currently when attempting to run the demo code I get the following :

File "m5stack_avatar.py" line 162 in start type error : object "bound_method" is not a tuple or list

    self.face_thread_id = _thread.start_new_thread('face' , self._display, ())
numeru55 commented 1 year ago

many API seems changed, so I edited m5stack_avatar.py as follows. Could you try?

$ diff m5stack_avatar.py_original m5stack_avatar.py
38a39,40
>         
>         self.q='' # add message to speak
41c43
<         _thread.allowsuspend(True)
---
>         #_thread.allowsuspend(True)
119a122
>         self.q=''
124c127,128
<             typ, sender, msg = _thread.getmsg()
---
>             #typ, sender, msg = _thread.getmsg()
>             msg=self.q
130,131c134,137
<         self.eye_blink_thread_id = _thread.start_new_thread('eye_blink', self._blink, ())
<         self.mouth_thread_id     = _thread.start_new_thread('mouth', self._mouth, ())
---
>         #self.eye_blink_thread_id = _thread.start_new_thread('eye_blink', self._blink, ())
>         #self.mouth_thread_id     = _thread.start_new_thread('mouth', self._mouth, ())
>         self.eye_blink_thread_id = _thread.start_new_thread(self._blink, ())
>         self.mouth_thread_id     = _thread.start_new_thread(self._mouth, ())
133,135c139,142
<             typ, sender, msg = _thread.getmsg()
<             if msg:
<                 _thread.sendmsg(self.mouth_thread_id, msg)
---
>             #typ, sender, msg = _thread.getmsg()
>             #msg=self.q
>             #if msg:
>                 #_thread.sendmsg(self.mouth_thread_id, msg)
162c169,170
<         self.face_thread_id = _thread.start_new_thread('face', self._display, ())
---
>         #self.face_thread_id = _thread.start_new_thread('face', self._display, ())
>         self.face_thread_id = _thread.start_new_thread(self._display, ())
165c173,174
<         _thread.sendmsg(self.face_thread_id, text)
---
>         #_thread.sendmsg(self.face_thread_id, text)
>         self.q=text
$