Skip to content

Commit 0263e8d

Browse files
committed
Improved stability
1 parent 58ba76d commit 0263e8d

4 files changed

Lines changed: 64 additions & 39 deletions

File tree

.github/workflows/push-master.yml

Lines changed: 38 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jobs:
99
###########################
1010

1111
HyperSerialPico:
12-
runs-on: ubuntu-22.04
12+
runs-on: ubuntu-24.04
1313

1414
steps:
1515
- uses: actions/checkout@v6.0.2
@@ -19,7 +19,7 @@ jobs:
1919
- name: Install GNU Arm Embedded Toolchain
2020
uses: carlosperate/arm-none-eabi-gcc-action@v1
2121
with:
22-
release: '15.2.Rel1'
22+
release: '14.2.Rel1'
2323

2424
- name: Build packages
2525
shell: bash
@@ -32,24 +32,25 @@ jobs:
3232
- uses: actions/upload-artifact@v7.0.0
3333
name: Upload artifacts (release)
3434
with:
35-
name: firmware-release-generic-rp2040
35+
name: firmware-release-generic-RP2040
3636
path: |
3737
firmware/*.uf2
3838
39-
- name: Build packages for generic rp2350
39+
- name: Build packages for generic RP2350
4040
shell: bash
4141
run: |
4242
cd build
4343
rm -rf *
4444
rm -rf ../firmware/*
4545
cmake -DTARGET_BOARD=pico2 -DCMAKE_BUILD_TYPE=Release ..
4646
cmake --build .
47-
zip -j ../firmware/firmware_generic_rp2350.zip ../firmware/*
47+
zip -j ../firmware/firmware_generic_RP2350.zip ../firmware/*
4848
4949
- uses: actions/upload-artifact@v7.0.0
50-
name: Upload artifacts (release generic rp2350)
50+
name: Upload artifacts (release generic RP2350)
5151
with:
52-
name: firmware-release-generic-rp2350
52+
name: firmware-release-generic-RP2350
53+
archive: false
5354
path: |
5455
firmware/*.zip
5556
@@ -59,16 +60,17 @@ jobs:
5960
cd build
6061
rm -rf *
6162
rm -rf ../firmware/*
62-
echo "Neopixel is using GPIO16(OUTPUT_DATA_PIN) on output 0." > ../firmware/Firmwares_for_Adafruit_Feather_RP2040_Scorpio.txt
63-
echo "SPI is using spi0 interface pins: GPIO19(OUTPUT_SPI_DATA_PIN) and GPIO18(OUTPUT_SPI_CLOCK_PIN) on output 3 and 2 respectively." >> ../firmware/Firmwares_for_Adafruit_Feather_RP2040_Scorpio.txt
63+
echo "Neopixel is using GPIO16(OUTPUT_DATA_PIN) on output 0." > ../firmware/Pinout_for_Adafruit_Feather_RP2040_Scorpio.txt
64+
echo "SPI is using spi0 interface pins: GPIO19(OUTPUT_SPI_DATA_PIN) and GPIO18(OUTPUT_SPI_CLOCK_PIN) on output 3 and 2 respectively." >> ../firmware/Pinout_for_Adafruit_Feather_RP2040_Scorpio.txt
6465
cmake -DOVERRIDE_BOOT_WORKAROUND=ON -DOVERRIDE_DATA_PIN=16 -DOVERRIDE_SPI_DATA_PIN=19 -DOVERRIDE_SPI_CLOCK_PIN=18 -DCMAKE_BUILD_TYPE=Release ..
6566
cmake --build .
6667
zip -j ../firmware/Adafruit_Feather_RP2040_Scorpio.zip ../firmware/*
6768
6869
- uses: actions/upload-artifact@v7.0.0
69-
name: Upload artifacts (release Adafruit_Feather)
70+
name: Upload artifacts (release for Adafruit_Feather_RP2040)
7071
with:
71-
name: firmware-release-adafruit-scorpio
72+
name: firmware-release-adafruit-scorpio-RP2040
73+
archive: false
7274
path: |
7375
firmware/*.zip
7476
@@ -78,35 +80,37 @@ jobs:
7880
cd build
7981
rm -rf *
8082
rm -rf ../firmware/*
81-
echo "Neopixel is using GPIO14(OUTPUT_DATA_PIN) on output 5." > ../firmware/Firmwares_for_Adafruit_ItsyBitsy_2040.txt
83+
echo "Neopixel is using GPIO14(OUTPUT_DATA_PIN) on output 5." > ../firmware/Pinout_for_Adafruit_ItsyBitsy_RP2040.txt
8284
cmake -DOVERRIDE_BOOT_WORKAROUND=ON -DOVERRIDE_DATA_PIN=14 -DCMAKE_BUILD_TYPE=Release ..
8385
cmake --build .
8486
rm ../firmware/*_Spi.uf2
85-
zip -j ../firmware/Adafruit_ItsyBitsy_2040.zip ../firmware/*
87+
zip -j ../firmware/Adafruit_ItsyBitsy_RP2040.zip ../firmware/*
8688
8789
- uses: actions/upload-artifact@v7.0.0
88-
name: Upload artifacts (release Adafruit_ItsyBitsy_2040)
90+
name: Upload artifacts (release for Adafruit_ItsyBitsy_RP2040)
8991
with:
90-
name: firmware-release-adafruit-itsybitsy-2040
92+
name: firmware-release-adafruit-itsybitsy-RP2040
93+
archive: false
9194
path: |
9295
firmware/*.zip
9396
94-
- name: Build packages for Pimoroni Plasma Stick 2040 W
97+
- name: Build packages for Pimoroni Plasma Stick RP2040 W
9598
shell: bash
9699
run: |
97100
cd build
98101
rm -rf *
99102
rm -rf ../firmware/*
100-
echo "Neopixel is using GPIO15(OUTPUT_DATA_PIN) on output PIXELS." > ../firmware/Firmwares_for_Pimoroni_Plasma_Stick_2040_W.txt
103+
echo "Neopixel is using GPIO15(OUTPUT_DATA_PIN) on output PIXELS." > ../firmware/Pinout_for_Pimoroni_Plasma_Stick_RP2040_W.txt
101104
cmake -DOVERRIDE_DATA_PIN=15 -DCMAKE_BUILD_TYPE=Release ..
102105
cmake --build .
103106
rm ../firmware/*_Spi.uf2
104-
zip -j ../firmware/Pimoroni_Plasma_Stick_2040_W.zip ../firmware/*
107+
zip -j ../firmware/Pimoroni_Plasma_Stick_RP2040_W.zip ../firmware/*
105108
106109
- uses: actions/upload-artifact@v7.0.0
107-
name: Upload artifacts (release Pimoroni_Plasma_Stick_2040_W)
110+
name: Upload artifacts (release for Pimoroni_Plasma_Stick_RP2040_W)
108111
with:
109-
name: firmware-release-pimoroni-plasma-stick-2040-w
112+
name: firmware-release-pimoroni-plasma-stick-RP2040-W
113+
archive: false
110114
path: |
111115
firmware/*.zip
112116
@@ -116,35 +120,37 @@ jobs:
116120
cd build
117121
rm -rf *
118122
rm -rf ../firmware/*
119-
echo "Neopixel is using GPIO15(OUTPUT_DATA_PIN) on output DA." > ../firmware/Firmwares_for_Pimoroni_Plasma_2040.txt
120-
echo "SPI is using spi1 interface pins: GPIO15(OUTPUT_SPI_DATA_PIN) and GPIO14(OUTPUT_SPI_CLOCK_PIN) on output DA and CL respectively." >> ../firmware/Firmwares_for_Pimoroni_Plasma_2040.txt
123+
echo "Neopixel is using GPIO15(OUTPUT_DATA_PIN) on output DA." > ../firmware/Pinout_for_Pimoroni_Plasma_RP2040.txt
124+
echo "SPI is using spi1 interface pins: GPIO15(OUTPUT_SPI_DATA_PIN) and GPIO14(OUTPUT_SPI_CLOCK_PIN) on output DA and CL respectively." >> ../firmware/Pinout_for_Pimoroni_Plasma_RP2040.txt
121125
cmake -DOVERRIDE_DATA_PIN=15 -DOVERRIDE_SPI_INTERFACE=spi1 -DOVERRIDE_SPI_DATA_PIN=15 -DOVERRIDE_SPI_CLOCK_PIN=14 -DCMAKE_BUILD_TYPE=Release ..
122126
cmake --build .
123-
zip -j ../firmware/Pimoroni_Plasma_2040.zip ../firmware/*
127+
zip -j ../firmware/Pimoroni_Plasma_RP2040.zip ../firmware/*
124128
125129
- uses: actions/upload-artifact@v7.0.0
126-
name: Upload artifacts (release Pimoroni_Plasma_2040)
130+
name: Upload artifacts (release for Pimoroni_Plasma_RP2040)
127131
with:
128-
name: firmware-release-pimoroni-plasma-2040
132+
name: firmware-release-pimoroni-plasma-RP2040
133+
archive: false
129134
path: |
130135
firmware/*.zip
131136
132-
- name: Build packages for Pimoroni Plasma 2350
137+
- name: Build packages for Pimoroni Plasma RP2350
133138
shell: bash
134139
run: |
135140
cd build
136141
rm -rf *
137142
rm -rf ../firmware/*
138-
echo "Neopixel is using GPIO15(OUTPUT_DATA_PIN) on output DA." > ../firmware/Firmwares_for_Pimoroni_Plasma_2350.txt
139-
echo "SPI is using spi1 interface pins: GPIO15(OUTPUT_SPI_DATA_PIN) and GPIO14(OUTPUT_SPI_CLOCK_PIN) on output DA and CL respectively." >> ../firmware/Firmwares_for_Pimoroni_Plasma_2350.txt
143+
echo "Neopixel is using GPIO15(OUTPUT_DATA_PIN) on output DA." > ../firmware/Pinout_for_Pimoroni_Plasma_RP2350.txt
144+
echo "SPI is using spi1 interface pins: GPIO15(OUTPUT_SPI_DATA_PIN) and GPIO14(OUTPUT_SPI_CLOCK_PIN) on output DA and CL respectively." >> ../firmware/Pinout_for_Pimoroni_Plasma_RP2350.txt
140145
cmake -DTARGET_BOARD=pico2 -DOVERRIDE_DATA_PIN=15 -DOVERRIDE_SPI_INTERFACE=spi1 -DOVERRIDE_SPI_DATA_PIN=15 -DOVERRIDE_SPI_CLOCK_PIN=14 -DCMAKE_BUILD_TYPE=Release ..
141146
cmake --build .
142-
zip -j ../firmware/Pimoroni_Plasma_2350.zip ../firmware/*
147+
zip -j ../firmware/Pimoroni_Plasma_RP2350.zip ../firmware/*
143148
144149
- uses: actions/upload-artifact@v7.0.0
145-
name: Upload artifacts (release Pimoroni_Plasma_2350)
150+
name: Upload artifacts (release for Pimoroni_Plasma_RP2350)
146151
with:
147-
name: firmware-release-pimoroni-plasma-rp2350
152+
name: firmware-release-pimoroni-plasma-RP2350
153+
archive: false
148154
path: |
149155
firmware/*.zip
150156
@@ -156,7 +162,7 @@ jobs:
156162
name: Publish Releases
157163
if: startsWith(github.event.ref, 'refs/tags')
158164
needs: [HyperSerialPico]
159-
runs-on: ubuntu-22.04
165+
runs-on: ubuntu-24.04
160166
permissions:
161167
contents: write
162168
steps:

include/main.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -151,10 +151,7 @@ void processData()
151151
}
152152
else if (frameState.getCount() == 0x2aa2 && (input == 0x15 || input == 0x35))
153153
{
154-
statistics.print(currentTime, base.processDataHandle, base.processSerialHandle);
155-
156-
if (input == 0x15)
157-
printf(HELLO_MESSAGE);
154+
statistics.print(currentTime, &base.receiverSemaphore, input == 0x15);
158155

159156
frameState.setRegroup(true);
160157

include/statistics.h

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@
2828
#ifndef STATISTICS_H
2929
#define STATISTICS_H
3030

31+
#include <atomic>
32+
3133
// statistics (stats sent only when there is no communication)
3234
class
3335
{
@@ -38,8 +40,11 @@ class
3840
uint16_t finalGoodFrames = 0;
3941
uint16_t finalShowFrames = 0;
4042
uint16_t finalTotalFrames = 0;
43+
std::atomic<bool> welcomeMessage = false;
4144

4245
public:
46+
std::atomic<bool> printLogs = false;
47+
4348
/**
4449
* @brief Get the start time of the current period
4550
*
@@ -113,15 +118,22 @@ class
113118
* @param curTime
114119
* @param taskHandle
115120
*/
116-
void print(unsigned long curTime, TaskHandle_t taskHandle1, TaskHandle_t taskHandle2)
121+
void print(unsigned long curTime, semaphore_t* receiverSemaphore, bool isWelcome)
117122
{
118-
char output[128];
119-
120123
startTime = curTime;
121124
goodFrames = 0;
122125
totalFrames = 0;
123126
showFrames = 0;
124127

128+
welcomeMessage.store(isWelcome);
129+
printLogs.store(true);
130+
sem_release(receiverSemaphore);
131+
}
132+
133+
void printToSerial(TaskHandle_t taskHandle1, TaskHandle_t taskHandle2)
134+
{
135+
char output[128];
136+
125137
snprintf(output, sizeof(output), "HyperHDR frames: %u (FPS), receiv.: %u, good: %u, incompl.: %u, mem1: %i, mem2: %i, heap: %zu\r\n",
126138
finalShowFrames, finalTotalFrames,finalGoodFrames,(finalTotalFrames - finalGoodFrames),
127139
(taskHandle1 != nullptr) ? uxTaskGetStackHighWaterMark(taskHandle1) : 0,
@@ -132,6 +144,11 @@ class
132144
#if defined(NEOPIXEL_RGBW)
133145
calibrationConfig.printCalibration();
134146
#endif
147+
148+
if (welcomeMessage.exchange(false))
149+
{
150+
printf(HELLO_MESSAGE);
151+
}
135152
}
136153

137154
/**

source/main.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,11 @@ static void core0( void *pvParameters )
153153
}
154154
}while(wanted == received);
155155

156+
if (statistics.printLogs.exchange(false))
157+
{
158+
statistics.printToSerial(base.processDataHandle, base.processSerialHandle);
159+
}
160+
156161
sem_release(&base.serialSemaphore);
157162
}
158163
}

0 commit comments

Comments
 (0)