Skip to content

Commit 9fd6eca

Browse files
committed
Minor corrections
1 parent 950f069 commit 9fd6eca

File tree

4 files changed

+18
-15
lines changed

4 files changed

+18
-15
lines changed

CMakeLists.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# Default output data pin for the LED strip
44
set(OUTPUT_DATA_PIN 2)
55

6-
# Default output data pin for the LED strip (SPI leds only, not for sk6812/ws2812b)
6+
# Default output clock pin for the LED strip (SPI leds only, not for sk6812/ws2812b)
77
set(OUTPUT_CLOCK_PIN 3)
88

99
# Use multi-segment, starting index of second led strip or OFF to disable
@@ -17,6 +17,9 @@ set(SECOND_SEGMENT_REVERSED OFF)
1717

1818
cmake_minimum_required(VERSION 3.13)
1919

20+
# Disable Pico 'Reset device'
21+
add_definitions ( -DPICO_STDIO_USB_ENABLE_RESET_VIA_VENDOR_INTERFACE=0 )
22+
2023
# initialize the SDK based on PICO_SDK_PATH
2124
# note: this must happen before project()
2225
set(PICO_SDK_PATH ${CMAKE_SOURCE_DIR}/sdk/pico)

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ HyperHDR's highspeed adalight serial port LED driver implementation for Raspberr
1717
# How to flash it?
1818
It's very easy and you don't need any special flasher.
1919
Download the firmware from the [Release folder](https://github.com/awawa-dev/HyperSerialPico/releases).
20-
* If you Pico board has only one button (`boot`) then press & hold it and connect the board to the USB port. Then you can release the button.
21-
* If you Pico board has two buttons, connect it to the USB port. Then press & hold `boot` and `reset` buttons, then release `reset` and next release `boot` button.
20+
* If your Pico board has only one button (`boot`) then press & hold it and connect the board to the USB port. Then you can release the button.
21+
* If your Pico board has two buttons, connect it to the USB port. Then press & hold `boot` and `reset` buttons, then release `reset` and next release `boot` button.
2222

2323
In the system file explorer you should find new drive (e.g. called `RPI-RP2` drive) exposed by the Pico board. Drap & drop the selected fimrware.
2424
The Pico will reset automaticly after the upload and after few seconds it will be ready to use by HyperHDR as a serial port device using Adalight driver.

include/leds.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,15 +48,15 @@
4848
ledStrip1->renderSingleLane();
4949
5050
Usage for sk6812 rgbw multi lanes:
51-
ledStrip1 = new sk6812(ledsNumber, DATA_PIN); // using DATA_PIN output
52-
ledStrip2 = new sk6812(ledsNumber, DATA_PIN); // using DATA_PIN + 1 output
51+
ledStrip1 = new sk6812p(ledsNumber, DATA_PIN); // using DATA_PIN output
52+
ledStrip2 = new sk6812p(ledsNumber, DATA_PIN); // using DATA_PIN + 1 output
5353
ledStrip1->SetPixel(index, ColorGrbw(255));
5454
ledStrip2->SetPixel(index, ColorGrbw(255));
5555
ledStrip1->renderAllLanes(); // renders ledStrip1 and ledStrip2 simoultaneusly
5656
5757
Usage for ws2812 rgb multi lanes:
58-
ledStrip1 = new ws2812(ledsNumber, DATA_PIN); // using DATA_PIN output
59-
ledStrip2 = new ws2812(ledsNumber, DATA_PIN); // using DATA_PIN + 1 output
58+
ledStrip1 = new ws2812p(ledsNumber, DATA_PIN); // using DATA_PIN output
59+
ledStrip2 = new ws2812p(ledsNumber, DATA_PIN); // using DATA_PIN + 1 output
6060
ledStrip1->SetPixel(index, ColorGrb(255));
6161
ledStrip2->SetPixel(index, ColorGrb(255));
6262
ledStrip1->renderAllLanes(); // renders ledStrip1 and ledStrip2 simoultaneusly

source/main.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -117,9 +117,7 @@ static void core1()
117117
{
118118
if (sem_acquire_timeout_us(&base.serialSemaphore, portMAX_DELAY))
119119
{
120-
//printf("Core %d: Start index: %i, End index: %i, (%u)\n", get_core_num(), base.queueCurrent, base.queueEnd, millis());
121120
processData();
122-
//printf("Core %d: Start index: %i, End index: %i, (%u)\n", get_core_num(), base.queueCurrent, base.queueEnd, millis());
123121
}
124122
}
125123
}
@@ -130,14 +128,16 @@ static void core0( void *pvParameters )
130128
{
131129
if (sem_acquire_timeout_us(&base.receiverSemaphore, portMAX_DELAY))
132130
{
133-
int total, toRead;
131+
int wanted, received;
134132
do
135133
{
136-
toRead = MAX_BUFFER - base.queueEnd;
137-
total = stdio_usb.in_chars((char*)(&(base.buffer[base.queueEnd])), MAX_BUFFER - base.queueEnd);
138-
if (total > 0)
139-
base.queueEnd = (base.queueEnd + total) % (MAX_BUFFER);
140-
}while(toRead==total);
134+
wanted = std::min(MAX_BUFFER - base.queueEnd, MAX_BUFFER - 1);
135+
received = stdio_usb.in_chars((char*)(&(base.buffer[base.queueEnd])), wanted);
136+
if (received > 0)
137+
{
138+
base.queueEnd = (base.queueEnd + received) % (MAX_BUFFER);
139+
}
140+
}while(wanted == received);
141141

142142
sem_release(&base.serialSemaphore);
143143
}

0 commit comments

Comments
 (0)