<br />
<b>Notice</b>:  函数 _load_textdomain_just_in_time 的调用方法<strong>不正确</strong>。 <code>twentyseventeen</code> 域的翻译加载触发过早。这通常表示插件或主题中的某些代码运行过早。翻译应在 <code>init</code> 操作或之后加载。 请查阅<a href="https://developer.wordpress.org/advanced-administration/debug/debug-wordpress/">调试 WordPress</a>来获取更多信息。 （这个消息是在 6.7.0 版本添加的。） in <b>/var/www/html/wp/wp-includes/functions.php</b> on line <b>6131</b><br />
{"id":187,"date":"2021-10-13T23:18:24","date_gmt":"2021-10-13T15:18:24","guid":{"rendered":"http:\/\/quziming.top\/?p=187"},"modified":"2021-10-13T23:36:02","modified_gmt":"2021-10-13T15:36:02","slug":"%e3%80%90%e4%b8%b2%e5%8f%a3%e8%b0%83%e8%af%95%e3%80%91%e9%80%9a%e8%bf%87%e4%b8%b2%e5%8f%a3%e5%8f%91%e9%80%81%e5%8f%98%e9%87%8f%e6%95%b0%e6%8d%ae%ef%bc%8c%e4%b8%8a%e4%bd%8d%e6%9c%bapython%e5%ae%9e","status":"publish","type":"post","link":"https:\/\/www.quziming.top\/?p=187","title":{"rendered":"\u3010\u4e32\u53e3\u8c03\u8bd5\u3011\u901a\u8fc7\u4e32\u53e3\u53d1\u9001\u53d8\u91cf\u6570\u636e\uff0c\u4e0a\u4f4d\u673apython\u5b9e\u65f6\u7ed8\u56fe"},"content":{"rendered":"\n<p>stm32\u901a\u8fc7uart\u53d1\u9001\u6570\u636e\u5e27\u7ed9\u4e0a\u4f4d\u673a\uff0c\u4e0a\u4f4d\u673a\u4f7f\u7528python\u63a5\u6536\u6570\u636e\u5e76\u7ed8\u5236\u6298\u7ebf\u56fe<\/p>\n\n\n\n<p><\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"c\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/\/debug\u53d1\u9001\u6570\u636e\u51fd\u6570\n#define DEBUG_PLT_START_BIT 0xfe\n#define DEBUG_PLT_STOP_BIT 0xff\n\ntypedef enum dataType{\n\tINT8_T = 0x10,\n\tINT16_T = 0x11,\n\tINT32_T = 0x12,\n\t\n\tUINT8_T = 0x00,\n\tUINT16_T = 0x01,\n\tUINT32_T = 0x02,\n\t\n\tFLOAT = 0x20,\n\n        CLEAR = 0x80, \n\n}dataType_t;\n\n\/\/\u7528\u4e8e\u6e05\u7a7a\u56fe\u4e2d\u539f\u6709\u6570\u636e\uff08\u7a0b\u5e8f\u521d\u59cb\u5316\u65f6\u7528\uff09\nvoid ClearDebugPltData(int8_t dataId){\n\tuint8_t sendData[8]={DEBUG_PLT_START_BIT, 0, CLEAR, 0, 0, 0, 0, DEBUG_PLT_STOP_BIT};\n\tsendData[1] = dataId;\n\tsendData[2] = CLEAR;\n\tHAL_UART_Transmit(&amp;DEBUG_UART, sendData, 8, 100);\n\tHAL_Delay(1);\n}\n\nvoid SendDebugPltData(int8_t dataId, dataType_t dataType, void* data, uint8_t dataLen){\n\tuint8_t sendData[8]={DEBUG_PLT_START_BIT, 0, 0, 0, 0, 0, 0, DEBUG_PLT_STOP_BIT};\n\tsendData[1] = dataId;\n\tsendData[2] = dataType;\n\tmemcpy(sendData + 3, data, dataLen);\n\tHAL_UART_Transmit(&amp;DEBUG_UART, sendData, 8, 100);\n}<\/pre>\n\n\n\n<p>C\u53d1\u9001\u6570\u636e\u4ee3\u7801\u793a\u4f8b<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">float data=10.05f;\nSendDebugPltData(1, FLOAT, &amp;data, sizeof(data));\n\nuint8_t data=100;\nSendDebugPltData(1, UINT8_T, &amp;data, sizeof(data));\n\nint32_t data=-3100;\nSendDebugPltData(1, INT32_T, &amp;data, sizeof(data));<\/pre>\n\n\n\n<p>python\u63a5\u6536\u4e32\u53e3\u6570\u636e\u5e76\u7ed8\u56fe\u4ee3\u7801<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">#-*- coding: utf-8 -*-\n \n# uart+\u7ed8\u56fe\u591a\u7ebf\u7a0b\n\nimport threading\nimport serial\nimport matplotlib.pyplot as plt\nimport numpy as np\nimport time\nimport re\nimport struct\nimport sys\n\nclass MyThread(threading.Thread):\n    def __init__(self,func,args=()):\n        super(MyThread,self).__init__()\n        self.func = func\n        self.args = args\n    def run(self):\n        self.result = self.func(*self.args)\n    def get_result(self):\n        try:\n            return self.result\n        except Exception:\n            return None\n\n\ncomport = \"\/dev\/cu.usbserial-0001\"#COM\u540d\u79f0\nbaudrate = \"115200\"#\u6ce2\u7279\u7387\nmaxLen=100#\u6700\u5927\u663e\u793a\u6570\u636e\u91cf\n\n\nHEX=\"0123456789abcdef\"\nSTART_BIT=0xfe\nEND_BIT=0xff\nlock = threading.Lock()\nt = [0]\nm = [0]\ni = 0\nintdata = 0\ndata = ''\ncount = 0\n\n\n\ndef initSerial():\n    global serialport\n    serialport = serial.Serial(comport, int(baudrate), timeout=1)\n    if serialport.isOpen():\n        print(\"open success\")\n    else:\n        print(\"open failed\")\n\ndef SerialReceive():\n    global t,m,serialport,i\n    rawData=b''\n    numData=b''\n\n    while True:\n        while True:\n            ch = serialport.read()\n            #print(type(ch),type(rawData))\n            rawData+=ch\n\n            if(len(rawData)>8):\n                rawData=rawData[len(rawData)-8:]\n            #print(rawData)\n            if (len(rawData)==8) and (rawData[0]==START_BIT) and (rawData[7]==END_BIT):\n                break\n        numData=rawData[3:7]#\u6570\u503c\u4f4d\n        dataId=rawData[1]#\u6570\u636e\u7f16\u53f7\n        dataType=rawData[2]#\u6570\u636e\u7c7b\u578b\n\n        \n\n        signed=(dataType &amp; 0x10) > 0#\u662f\u5426\u542b\u7b26\u53f7\u4f4d\n        decimal=(dataType &amp; 0x20) > 0#\u662f\u5426\u4e3a\u5c0f\u6570\n\n        if dataType==0x80:\n            lock.acquire()\n            i=0\n            t=[]\n            m=[]\n            plt.cla()\n            lock.release()\n            rawData=b''\n            continue\n\n        print(f\"dataId:{dataId} signed:{signed} decimal:{decimal} dataType:{dataType}\")\n        #print(f\"{HEX[numData[0]\/\/16]}{HEX[numData[0]%16]}{HEX[numData[1]\/\/16]}{HEX[numData[1]%16]}{HEX[numData[2]\/\/16]}{HEX[numData[2]%16]}{HEX[numData[3]\/\/16]}{HEX[numData[3]%16]}\")\n\n        if not decimal:\n            if (dataType &amp; 0x0f == 0x00):\n                data = int.from_bytes(numData[:1], byteorder='little', signed = signed)\n            elif (dataType &amp; 0x0f == 0x01):\n                data = int.from_bytes(numData[:2], byteorder='little', signed = signed)\n            else:\n                data = int.from_bytes(numData[:4], byteorder='little', signed = signed)\n        else:\n            \n            data = struct.unpack('f', numData)[0]\n\n        i = i+1\n        print(i,data)\n\n        lock.acquire()\n        t.append(i)\n        m.append(data)\n\n        lock.release()\n        rawData=b''\n        \n    \n    \ndef StartSerialReceive():\n    thread = MyThread(SerialReceive,args=())\n    thread.setDaemon(True)\n    thread.start()\n    \ndef initPlt():\n    plt.grid(True) # \u6dfb\u52a0\u7f51\u683c\n    plt.ion()   # interactive mode\n    plt.figure(1)\n    plt.xlabel('times')\n    plt.ylabel('data')\n    plt.title('Diagram of UART data by Python')\n\n\ndef drawPlt():\n    global t,m\n    if not lock.locked():\n        lock.acquire()\n        if len(t) > maxLen:  # \u6e05\u9664\u753b\u5e03\uff0c\u91cd\u65b0\u5f00\u59cb\uff0c\u907f\u514d\u6570\u636e\u91cf\u8fc7\u5927\u5bfc\u81f4\u5361\u987f\u3002\n            t = t[len(t)-maxLen:]\n            plt.cla()\n        if len(m) > maxLen:  # \u6e05\u9664\u753b\u5e03\uff0c\u91cd\u65b0\u5f00\u59cb\uff0c\u907f\u514d\u6570\u636e\u91cf\u8fc7\u5927\u5bfc\u81f4\u5361\u987f\u3002\n            m = m[len(m)-maxLen:]\n            plt.cla()\n        lock.release()\n    lock.acquire()\n    plt.plot(t, m, '-r')\n    plt.draw()\n    lock.release()\n\n\nprint(sys.argv)\n\nif (len(sys.argv) > 2):\n    if (sys.argv[1]==\"-len\"):\n        maxLen = int(sys.argv[2])\n        print(f\"\u6700\u5927\u6570\u636e\u957f\u5ea6\u4fee\u6539\u4e3a{maxLen}\")\ninitSerial()\ninitPlt()\nStartSerialReceive()\n\n\nwhile True:\n    drawPlt()\n    plt.pause(0.002)\n\n\n\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>stm32\u901a\u8fc7uart\u53d1\u9001\u6570\u636e\u5e27\u7ed9\u4e0a\u4f4d\u673a\uff0c\u4e0a\u4f4d\u673a\u4f7f\u7528python\u63a5\u6536\u6570\u636e\u5e76\u7ed8\u5236\u6298\u7ebf\u56fe C\u53d1\u9001\u6570\u636e\u4ee3\u7801\u793a\u4f8b py &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/www.quziming.top\/?p=187\" class=\"more-link\">\u7ee7\u7eed\u9605\u8bfb<span class=\"screen-reader-text\">\u201c\u3010\u4e32\u53e3\u8c03\u8bd5\u3011\u901a\u8fc7\u4e32\u53e3\u53d1\u9001\u53d8\u91cf\u6570\u636e\uff0c\u4e0a\u4f4d\u673apython\u5b9e\u65f6\u7ed8\u56fe\u201d<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[10,16],"tags":[21,12,18,20],"class_list":["post-187","post","type-post","status-publish","format-standard","hentry","category-stm32","category-uart","tag-python","tag-stm32","tag-uart","tag-20"],"_links":{"self":[{"href":"https:\/\/www.quziming.top\/index.php?rest_route=\/wp\/v2\/posts\/187","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.quziming.top\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.quziming.top\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.quziming.top\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.quziming.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=187"}],"version-history":[{"count":14,"href":"https:\/\/www.quziming.top\/index.php?rest_route=\/wp\/v2\/posts\/187\/revisions"}],"predecessor-version":[{"id":204,"href":"https:\/\/www.quziming.top\/index.php?rest_route=\/wp\/v2\/posts\/187\/revisions\/204"}],"wp:attachment":[{"href":"https:\/\/www.quziming.top\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=187"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.quziming.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=187"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.quziming.top\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=187"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}