完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
您好,
我想使用 wemos d1 mini 与我的 python 程序进行通信,但我遇到了一个问题。我想在我的 ili9341 显示器上显示自定义“无信号”标志,当 python 运行时一切正常,但一旦 wemos 没有收到任何东西,它就会开始发送一些奇怪的东西: 软 WDT 复位 >>> 堆栈 >>> ctx:cont sp:3ffffc30 结束:3fffffc0 偏移量:01a0 3ffffdd0:3ffe8675 00000002 3ffefc88 402018be 3ffffde0: 3ffe866d 00000000 3ffefc88 40201a09 3ffffdf0: 00000007 00000000 00000080 40201b91 3ffffe00: 0098009e 00000000 40201fffe0:08 fff1fffe0: 08 3ffffe20: 3f000000 00000000 00000001 fffffffe 3ffffe30: 00000000 3ffefca8 3ffefc88 40201ed5 3ffffe40: 3ffefd38 0000007e 3ffefc88 402018a2 3ffffe50: 3ffefc88 3ffefca8 3ffefc88 402020f3 3ffffe60: 00000000 000000af 3ffefc88 40202b90 3ffffe70: 00000000 00000052 3ffefc88 40202e71 3ffffe80: 3ffefc88 00000002 3ffefc88 4020263b 3ffffe90: 00000000 00000052 3ffefc88 4020246d 3ffffea0: 3ffe9d92 00000001 00000000 00000001 3ffffeb0: 00000008 00000001 00000000 000000da 3ffffec0: 000000af 00000003 00000000 3ffefc88 3ffffed0: 00000052 000000da 00000000 40202f3c 3ffffee0: 0000004e 00000002 3ffefc88 000000af 3ffffef0: 00000001 3ffefc88 00000001 3ffe861b 3fffff00: 3ffe8628 3ffefc80 3ffefc80 40204269 3fffff10: 00000072 000000ac 00000003 40206aa2 3fffff20: 00000071 0000000e 000000ac 3ffefdc0 3fffff30: 40206a70 3ffefc80 3ffe8617 40204585 3fffff40: 3ffe84cc 3ffefc80 3ffefc88 4020459c 3fffff50: 3ffe84cc 3ffefc80 3ffefc88 4020338a 3fffff60: 00f42400 00000000 3ffefc88 40203b0d 3fffff70: 00000000 000000e4 3ffefc88 402035c0 3fffff80: 00000000 00000000 00000001 40100154 3fffff90: 3fffdad0 00000000 3ffefd80 3ffefdc0 3fffffa0: 3fffdad0 00000000 3ffefd80 40204d14 3fffffb0: feefeffe feefeffe 3ffe84ec 40100bed << ets Jan 8 2013,rst cause:2, boot mode:(3,6) load 0x4010f000, len 3584, room 16 tail 0 chksum 0xb0 csum 0xb0 v2843a5ac ~ld 我不想要它因为我的arduino代码认为串行可用并且我不希望这 是我的 arduino IDE 代码: 代码:全选#include #include "Ucglib.h" #define TIME_TO_DISCONNECT 4000 #define DELAY 100 #define MINI_FONT ucg_font_7x13r //ucg_font_7x13r ucg_font_helvB12r #define DEFAULT_FONT ucg_font_helvB24r //Ucglib_ILI9341_18x240x320_SWSPI ucg(/*sclk=*/ 13, /*data=*/ 11, /*cd=*/ 9 , /*cs=*/ 5, /*reset=*/ 8); Ucglib_ILI9341_18x240x320_HWSPI ucg(/*cd=*/ 5 , /*cs=*/ 15, /*reset=*/ -1); //Ucglib_ILI9341_18x240x320_HWSPI ucg(/*cd=*/ 9 , /*cs=*/ 5, /*reset=*/ 8); byte CPUtemp = 0; byte GPUtemp = 0; float RAMload = 0; //byte RAMloadI; byte cpuRGB[] = {0, 255, 0}; byte gpuRGB[] = {0, 250, 255}; byte ramRGB[] = {40, 180, 255}; byte preGPUtemp; byte preCPUtemp; float preRAMload; int countDis; boolean startUpWhenCon = false; boolean startUpWhenDis = true; void setup() { pinMode(2, OUTPUT); digitalWrite(2, HIGH); delay(1000); ucg.begin(UCG_FONT_MODE_SOLID); ucg.setRotate180(); ucg.setColor(255, 255, 255); //ucg.clearScreen(); //this should be uncommented but wemos get stuck on it and wont go further ucg.setFont(MINI_FONT); drawMiniCPUicon(); drawGPUicon(); drawRAMicon(); ucg.setFont(DEFAULT_FONT); Serial.begin(115200); } void loop() { if (Serial.available() > 0) { String s = Serial.readString(); preCPUtemp = CPUtemp; preGPUtemp = GPUtemp; preRAMload = RAMload; if (startUpWhenCon) { ucg.setColor(0, 0, 0); ucg.drawBox(60, 65, 189, 155); startUpWhenCon = false; startUpWhenDis = true; ucg.setFont(MINI_FONT); drawMiniCPUicon(); drawGPUicon(); drawRAMicon(); ucg.setFont(DEFAULT_FONT); } countDis = 0; if (s.length() > 4) { CPUtemp = s.toInt(); } else if (s.length() > 2) { RAMload = s.toFloat(); } else { GPUtemp = s.toInt(); } byte mappedCPUtemp = map(CPUtemp, 10, 100, 239, 0); byte mappedGPUtemp = map(GPUtemp, 10, 100, 239, 0); byte mappedRAMload = map(RAMload * 10, 0, 170, 239, 0); //////////CPU///////////////////////////////////////////////////////////////////////// if (CPUtemp >= 10 && CPUtemp < 100 && preCPUtemp != CPUtemp) updateInfo(0, mappedCPUtemp, cpuRGB, CPUtemp); //////////GPU///////////////////////////////////////////////////////////////////////// if (GPUtemp >= 10 && GPUtemp < 100 && preGPUtemp != GPUtemp) updateInfo(80, mappedGPUtemp, gpuRGB, GPUtemp); //////////RAM///////////////////////////////////////////////////////////////////////// if (RAMload > 0 && preRAMload != RAMload) { columns(160, mappedRAMload, ramRGB); ucg.setColor(255, 255, 255); if (RAMload < 10) { ucg.setPrintPos(165, mappedRAMload - 6); ucg.print(RAMload, 1); printGB(mappedRAMload, 217); } else { ucg.setPrintPos(168, mappedRAMload - 6); ucg.print(RAMload, 0); printGB(mappedRAMload, 211); } } } else if (countDis >= TIME_TO_DISCONNECT) { if (startUpWhenDis) { CPUtemp = 0; GPUtemp = 0; RAMload = 0; ucg.clearScreen(); ucg.setFont(MINI_FONT); drawSleepingToster(); ucg.setFont(DEFAULT_FONT); startUpWhenDis = false; startUpWhenCon = true; } sleepingAnimation(); } else { countDis++; delay(1); } } //funkcje///////////////////////////// void updateInfo(byte x, byte mappedValue, byte rgb[], byte temp) { columns(x, mappedValue, rgb); ucg.setColor(255, 255, 255); ucg.setPrintPos(x + 5, mappedValue - 6); ucg.print(temp); ucg.print(" C"); ucg.drawDisc(x + 45, mappedValue - 26, 4, UCG_DRAW_ALL); ucg.setColor(0, 0, 0); ucg.drawDisc(x + 45, mappedValue - 26, 1, UCG_DRAW_ALL); } void columns(byte x, byte mappedValue, byte rgb[]) { ucg.setColor(0, 0, 0, 0); ucg.drawBox(x, 0, 80, mappedValue + 1); ucg.setColor(0, rgb[0], rgb[1], rgb[2]); for (byte i = 239; i > mappedValue; i--) { ucg.drawHLine(x, i, 80); } } void sleepingAnimation() { //poczatkowa/nizsza pozycja ucg.drawBox(137, 98, 7, 7); ucg.setColor(0, 0, 0); ucg.drawBox(137, 94, 7, 4); ucg.setColor(255, 255, 255); delay(DELAY); ucg.setPrintPos(147, 100); ucg.print("z"); delay(DELAY); ucg.setPrintPos(167, 95); ucg.print("Z"); ucg.setColor(0, 0, 0); ucg.drawBox(167, 66, 20, 4); delay(DELAY); //wyzsza pozycja ucg.setColor(255, 255, 255); ucg.drawBox(137, 94, 7, 7); ucg.setColor(0, 0, 0); ucg.drawBox(137, 101, 7, 4); delay(DELAY); ucg.setColor(255, 255, 255); ucg.setPrintPos(147, 96); ucg.print("z"); delay(DELAY); ucg.setPrintPos(167, 91); ucg.print("Z"); delay(DELAY); } void drawSleepingToster() { ucg.setColor(255, 255, 255); ucg.drawRBox(61, 115, 118, 81, 19); ucg.drawBox(61, 134, 30, 70); ucg.drawBox(149, 134, 30, 70); ucg.drawBox(179, 142, 8, 7); ucg.setColor(0, 0, 0); ucg.drawBox(84, 119, 73, 5); ucg.drawRBox(86, 151, 22, 8, 1); ucg.drawRBox(132, 151, 22, 8, 1); ucg.drawRBox(113, 171, 14, 6, 1); ucg.setColor(255, 255, 255); ucg.setPrintPos(61, 218); ucg.print("// No Signal...//"); } void printGB(byte mappedValue, byte x) { //G ucg.drawDisc(x, mappedValue - 13, 6, UCG_DRAW_ALL); ucg.setColor(0, 0, 0); ucg.drawDisc(x, mappedValue - 13, 3, UCG_DRAW_ALL); ucg.drawTriangle(/*right*/224, mappedValue - 13 ,/*top*/ 224, mappedValue - 25,/*mid*/ 216, mappedValue - 13); ucg.setColor(255, 255, 255); ucg.drawBox(x, mappedValue - 13, 4, 2); //B ucg.drawRBox(x + 9, mappedValue - 19, 9, 8, 3); ucg.drawRBox(x + 9, mappedValue - 14, 9, 8, 3); ucg.setColor(0, 0, 0); ucg.drawRBox(x + 10, mappedValue - 17, 5, 4, 1); ucg.drawRBox(x + 10, mappedValue - 12, 5, 4, 1); ucg.setColor(255, 255, 255); ucg.drawBox(x + 9, mappedValue - 19, 3, 13); } void drawRAMicon() { ucg.setColor(ramRGB[0], ramRGB[1], ramRGB[2]); ucg.drawBox(160, 240, 80, 80); ucg.setColor(255, 255, 255); ucg.drawBox(169, 262, 62, 27); ucg.setColor(ramRGB[0], ramRGB[1], ramRGB[2]); ucg.drawRBox(160, 266, 12, 5, 1); ucg.drawRBox(228, 266, 12, 5, 1); ucg.drawBox(175, 267, 9, 14); ucg.drawBox(188, 267, 9, 14); ucg.drawBox(201, 267, 7, 14); ucg.drawBox(211, 267, 4, 6); ucg.drawBox(211, 275, 4, 6); ucg.drawBox(218, 267, 7, 14); ucg.setColor(255, 255, 255); for (byte i = 172; i < 200; i += 4) { ucg.drawFrame(i, 288, 4, 5); } for (byte i = 204; i < 227; i += 4) { ucg.drawFrame(i, 288, 4, 5); } ucg.setPrintPos(160, 236); ucg.print("Init..."); } void drawGPUicon() { ucg.setColor(gpuRGB[0], gpuRGB[1], gpuRGB[2]); ucg.drawBox(80, 240, 80, 80); ucg.setColor(255, 255, 255); ucg.drawRBox(89, 257, 61, 40, 8); ucg.drawBox(89, 257, 20, 40); ucg.drawBox(85, 254, 7, 3); ucg.drawBox(89, 257, 3, 46); for (byte i = 106; i < 137; i += 4) { ucg.drawFrame(i, 296, 4, 5); } ucg.setColor(gpuRGB[0], gpuRGB[1], gpuRGB[2]); ucg.drawLine(123, 300, 124, 300); ucg.drawDisc(106, 276, 12, UCG_DRAW_ALL); ucg.drawRBox(122, 268, 19, 6, 1); ucg.drawRBox(122, 281, 19, 6, 1); ucg.setColor(255, 255, 255); ucg.drawRBox(103, 274, 7, 7, 1); ucg.setPrintPos(80, 236); ucg.print("Init..."); } void drawMiniCPUicon() { ucg.setColor(cpuRGB[0], cpuRGB[1], cpuRGB[2]); ucg.drawBox(0, 240, 80, 80); ucg.setColor(255, 255, 255); for (byte i = 12; i < 40; i += 12) { ucg.drawRBox(13, i + 253, 54, 6, 2); ucg.drawRBox(i + 13, 253, 6, 54, 2); } ucg.drawRBox(19, 259, 42, 42, 2); ucg.setColor(0, cpuRGB[0], cpuRGB[1], cpuRGB[2]); ucg.drawRBox(25, 265, 30, 30, 2); ucg.setColor(255, 255, 255); ucg.drawRBox(31, 271, 18, 18, 2); ucg.setPrintPos(0, 236); ucg.print("Init..."); } /*void drawBigCPUicon() { ucg.setColor(0, cpuRGB[0], cpuRGB[1], cpuRGB[2]); ucg.drawBox(0, 239, 79, 80); ucg.setColor(0, 255, 255, 255); for (int i = 12; i < 50; i += 12) { ucg.drawRBox(7, i + 247, 66, 6, 2); ucg.drawRBox(i + 7, 247, 6, 66, 2); } ucg.drawRBox(13, 253, 54, 54, 2); ucg.setColor(0, cpuRGB[0], cpuRGB[1], cpuRGB[2]); ucg.drawRBox(19, 259, 42, 42, 2); ucg.setColor(0, 255, 255, 255); ucg.drawRBox(25, 265, 30, 30, 2); }*/ 和我的蟒蛇代码: 代码:全选import serial import time import wmi import math global w w = wmi.WMI(namespace="rootOpenHardwareMonitor") global cpu global gpu global ram """ def getRamSize(): used = 0 free = 0 hw_infos = w.Sensor() for sensor in hw_infos: if sensor.SensorType==u'Data': if sensor.Name == u'Used Memory': used = int(math.ceil(sensor.Value)) elif sensor.Name == u'Available Memory': free = int(math.ceil(sensor.Value)) return used + free """ def updateHWData(): global w global cpu global gpu global ram hw_infos = w.Sensor() cpu = [] gpu = [] ram = [] for sensor in hw_infos: #print (sensor.SensorType) #print(sensor.Name) #print(sensor.Value) if sensor.SensorType==u'Temperature': if sensor.Name == u'CPU Package': cpu.insert(0, "000%d" % sensor.Value) elif sensor.Name == u'GPU Core': gpu.insert(0, "%d" % sensor.Value) # if sensor.SensorType==u'Clock': # if sensor.Name == u'CPU Core #1': # cpu.insert(1, "CPU clk: %dMHz" % sensor.Value) # elif sensor.Name == u'GPU Core': # gpu.insert(1, "GPU clk: %dMHz " % sensor.Value) if sensor.SensorType==u'Data': if sensor.Name == u'Used Memory': ram.insert(0, "%.1f" % sensor.Value) def serial_ports(): ports = ['COM%s' % (i + 1) for i in range(256)] #['COM%s' % (i + 1) for i in range(256)] / ['COM%s' % (i + 1) for i in range(0,8,7)] dla COM8 result = [] for port in ports: try: s = serial.Serial(port) s.close() result.append(port) except (OSError, serial.SerialException): pass return result arduino = serial.Serial(serial_ports()[1], 115200, timeout=.7) #arduino = serial.Serial('COM8', 9600, timeout=.7) time.sleep(2) arduino.write("start".encode()) time.sleep(0.5) while len(w.Sensor()) < 1: time.sleep(1) cpu = [] gpu = [] #ram = ["RAM total: {:2d}GB ".format(getRamSize())] |
|
相关推荐
|
|
只有小组成员才能发言,加入小组>>
486 浏览 1 评论
552浏览 6评论
461浏览 5评论
有没有办法在不使用混杂模式的情况下实现Wifi驱动程序接收缓冲区访问中断呢?
443浏览 5评论
445浏览 4评论
415浏览 4评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-11-23 20:16 , Processed in 0.734898 second(s), Total 79, Slave 61 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号