大佬教程收集整理的这篇文章主要介绍了没有足够的 CPU 能力?,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
我想知道是否有人可以帮助我?
我有一个 5M LEDStrip(300 个 LED)并在我的 ESP32 上运行以下代码。 该代码将使 LED 灯旋转!
@H_262_6@voID spinningwheel(){
int random_number;
int spin_speed;
for(int i =0; i < 1; i++){
random_number = random(NUM_LEDS);
}
serial.println(random_number);
for (int i = 0; i <= random(6,15); i++){
spin_speed = i+1;
for (int i = 0; i <= NUM_LEDS; i++){
leds[i] = CRGB ( 0,255);
leds[i-10] = CRGB ( 0,0);
FastLED.show();
delay(spin_speed);
}
FastLED.clear();
}
for (int i = 0; i <= random_number; i++){
leds[i] = CRGB ( 0,0);
FastLED.show();
delay(spin_speed);
}
FastLED.clear();
delay(1000);
}
如果我使用 leds[i-3] = CRGB ( 0,0);
,代码工作正常
但是当我将数字 i-3
更改为某些东西时
比如 i-10
我的串口出现错误
15:51:36.233 -> 258
15:51:36.267 -> Guru Meditation Error: Core 1 panic'ed (StoreProhibited).
Exception was unhandled.
15:51:36.335 -> Core 1 register dump:
15:51:36.368 -> PC : 0x400d12ae PS : 0x00060930 A0 :
0x800d1658 A1 : 0x3ffb1e80
15:51:36.469 -> A2 : 0x3ffc0124 A3 : 0x3ffb1ea4 A4 :
0x3ffc04bc A5 : 0x3ffb1eb0
15:51:36.571 -> A6 : 0x00000000 A7 : 0x3ffb0060 A8 :
0x00000000 A9 : 0x3ffb1e40
15:51:36.639 -> A10 : 0x00000001 A11 : 0x00000000 A12 :
0x3ffb8570 A13 : 0x00000000
15:51:36.742 -> A14 : 0x3ffb8528 A15 : 0x00000000 SAR :
0x00000020 EXCCAUSE: 0x0000001d
15:51:36.843 -> EXCVADDR: 0x00000000 LBEG : 0x400d0dfd LEND :
0x400d0e0c LCOUNT : 0x00000000
15:51:36.944 ->
15:51:36.944 -> BACktrace: 0x400d12ae:0x3ffb1e80 0x400d1655:0x3ffb1ea0
0x400d1741:0x3ffb1ee0 0x400d0ee0:0x3ffb1f20 0x400d0fe1:0x3ffb1f40
0x400d115e:0x3ffb1f70 0x400d118f:0x3ffb1f90 0x400d216d:0x3ffb1fb0
0x40088215:0x3ffb1fd0
15:51:37.147 ->
15:51:37.147 -> RebooTing...
15:51:37.180 -> :⸮⸮⸮⸮L⸮⸮1⸮m֊⸮1
HL⸮⸮b⸮⸮⸮
错误的解码
@H_262_6@PC: 0x400d12ae: ClocklessController14,60,150,90,(EOrder)66,false,5>::showPixels(PixelController(EOrder)66,1,4294967295u>&) at
D:\documenten\Arduino\librarIEs\FastLED/controller.h line 178
EXCVADDR: 0x00000000
DeCoding stack results
0x400d12ae: ClocklessController14,4294967295u>&) at
D:\documenten\Arduino\librarIEs\FastLED/controller.h line 178
0x400d1655: CPixelLEDController(EOrder)66,4294967295u>::show(CRGB const*,int,CRGB) at D:\documenten\Arduino\librarIEs\FastLED/controller.h line 408
0x400d1741: CFastLED::show(unsigned char) at
D:\documenten\Arduino\librarIEs\FastLED/controller.h line 90
0x400d0ee0: CFastLED::show() at
D:\documenten\Arduino\librarIEs\FastLED/FastLED.h line 500
0x400d0fe1: spinningwheel() at
D:\documenten\Arduino\LedStrip_wave/LedStrip_wave.ino line 48
0x400d115e: Binair_buttons() at
D:\documenten\Arduino\LedStrip_wave/LedStrip_wave.ino line 125
0x400d118f: loop() at D:\documenten\Arduino\LedStrip_wave/LedStrip_wave.ino
line 141
0x400d216d: loopTask(void*) at
C:\Users\....\ApPDAta\Local\Arduino15\packages\esp32\
harDWare\esp32\1.0.4\cores\esp32\main.cpp line 19
0x40088215: vPortTaskWrapper at /home/runner/work/esp32-arduino-lib-
builder/esp32-arduino-lib-builder/esp-IDf/components/freertos/port.c line 143
有人可以解释一下我做错了什么吗?或者我是否超过了最大 RAM 或 cpu 使用率。
您拥有索引从 0 到 NUM_LEDS-1 的颜色数组,如果您在该空间之前或之后使用索引,那么您正在破坏不该破坏的东西。 现在:
@H_262_6@for (int i = 0; i <= NUM_LEDS; i++){ // values of i 0 .. NUM_LEDS (including! -buffer overflow)
leds[i] = CRGB ( 0,255);
leds[i-10] = CRGB ( 0,0); // for all i less than 0,you are BEFORE the actual array
所以你已经实现了两边的阵列之外。在第一个元素之前使用三个元素显然不会对程序造成太大的破坏,但是在第一个元素之前的 10 个元素肯定会破坏一些非常重要的东西。并且追求数组边界会破坏它之后存储的东西..
以上是大佬教程为你收集整理的没有足够的 CPU 能力?全部内容,希望文章能够帮你解决没有足够的 CPU 能力?所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。