Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <Arduino.h>
- #include <ESP8266WiFi.h>
- #include <FS.h>
- #include <Hash.h>
- #include <NeoPixelBus.h>
- NeoPixelBus<DotStarBgrFeature, DotStarSpiMethod> strip(144);
- static int Current_imageLine=0;
- static uint32_t _raw_location;
- uint8_t * LED_BUFFER;
- static uint32_t _memory_pointer=0,frame_time=0;
- IPAddress apIP(192, 168, 4, 1);
- void setup() {
- Serial.begin(115200);
- delay(500);
- Serial.setDebugOutput(true);
- Serial.println(F("\n \nStarting....."));
- SPIFFS.begin();
- strip.Begin();
- WiFi.mode(WIFI_AP);
- WiFi.softAPConfig(apIP, apIP, IPAddress(255, 255, 255, 0));
- WiFi.softAP("ESP_SPI","12345678");
- delay(500);
- Serial.print("AP IP address: ");Serial.println(WiFi.softAPIP());
- _raw_location=(ESP.getSketchSize() + FLASH_SECTOR_SIZE - 1) & (~(FLASH_SECTOR_SIZE - 1));
- _memory_pointer=_raw_location;
- Serial.printf("New Start Address= %u\n",_raw_location);
- LED_BUFFER = (uint8_t *)malloc(432);
- }
- void loop()
- {
- ESP.flashRead(_memory_pointer,(uint32_t *) LED_BUFFER,432); // it took around 13ms
- for( int i = 0;i<432; ) strip.SetPixelColor(i/3, RgbColor((byte)LED_BUFFER[i++], (byte)LED_BUFFER[i++],(byte)LED_BUFFER[i++]) );
- strip.Show();
- /*
- code of source lib
- https://github.com/Makuna/NeoPixelBus/blob/70e3611bdff0274ac7e75700f83d7af680611547/src/internal/DotStarSpiMethod.h#L67-L90
- */
- _memory_pointer+=(432);
- Current_imageLine++;
- if(Current_imageLine>=200)
- {
- Serial.printf("\nFrame took %u ms line=%d\n", micros() - frame_time,Current_imageLine);
- //Frame took 241860 ms line=200
- Current_imageLine=0;
- _memory_pointer=_raw_location;
- frame_time=micros();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement