Remove old stuff

This commit is contained in:
Thomas Farstrike
2025-06-15 09:50:06 +02:00
parent daea01c674
commit 1423dfed9a
3 changed files with 0 additions and 357 deletions
-155
View File
@@ -1,155 +0,0 @@
[
{
"name": "BTC Ticker",
"publisher": "ACME Inc",
"short_description": "Bitcoin Price Ticker",
"long_description": "Uses a websocket to show the current price of Bitcoin in US Dollar.",
"icon_url": "http://demo.lnpiggy.com:2121/apps/com.example.btcticker_0.0.1.mpk_icon_64x64.png",
"download_url": "http://demo.lnpiggy.com:2121/apps/com.example.btcticker_0.0.1.mpk",
"fullname": "com.example.btcticker",
"version": "0.0.1",
"entrypoint": "assets/bitcoin_price.py",
"category": "money"
}
,{
"name": "Camera Tester",
"publisher": "ACME Inc",
"short_description": "Simple test of the camera",
"long_description": "A simple test of the camera makes it possible to validate the hardware.",
"icon_url": "http://demo.lnpiggy.com:2121/apps/com.example.camtest_0.0.2.mpk_icon_64x64.png",
"download_url": "http://demo.lnpiggy.com:2121/apps/com.example.camtest_0.0.2.mpk",
"fullname": "com.example.camtest",
"version": "0.0.2",
"entrypoint": "assets/camtest.py",
"category": "camera"
}
,{
"name": "CPU Tester",
"publisher": "ACME Inc",
"short_description": "Testing the CPU speed",
"long_description": "Experimentally determines how many idle loops and sha256-hashing loops the CPU can perform per second.",
"icon_url": "http://demo.lnpiggy.com:2121/apps/com.example.cputest_0.0.1.mpk_icon_64x64.png",
"download_url": "http://demo.lnpiggy.com:2121/apps/com.example.cputest_0.0.1.mpk",
"fullname": "com.example.cputest",
"version": "0.0.1",
"entrypoint": "assets/cputest.py",
"category": "benchmarking"
}
,{
"name": "Draw",
"publisher": "ACME Inc",
"short_description": "Simple drawing app",
"long_description": "Draw simple shapes on the screen.",
"icon_url": "http://demo.lnpiggy.com:2121/apps/com.example.draw_0.0.1.mpk_icon_64x64.png",
"download_url": "http://demo.lnpiggy.com:2121/apps/com.example.draw_0.0.1.mpk",
"fullname": "com.example.draw",
"version": "0.0.1",
"entrypoint": "assets/draw.py",
"category": "art"
}
,{
"name": "HelloWorld",
"publisher": "ACME Inc",
"short_description": "Minimal app",
"long_description": "Demonstrates the simplest app.",
"icon_url": "http://demo.lnpiggy.com:2121/apps/com.example.helloworld_0.0.1.mpk_icon_64x64.png",
"download_url": "http://demo.lnpiggy.com:2121/apps/com.example.helloworld_0.0.1.mpk",
"fullname": "com.example.helloworld",
"version": "0.0.1",
"entrypoint": "assets/hello.py",
"category": "development"
}
,{
"name": "IMU Tester",
"publisher": "ACME Inc",
"short_description": "Test the Inertial Measurement Unit",
"long_description": "It is always good to make sure the accelerometer is working properly. How else can you measure acceleration and position?",
"icon_url": "http://demo.lnpiggy.com:2121/apps/com.example.imutest_0.0.1.mpk_icon_64x64.png",
"download_url": "http://demo.lnpiggy.com:2121/apps/com.example.imutest_0.0.1.mpk",
"fullname": "com.example.imutest",
"version": "0.0.1",
"entrypoint": "assets/imutest.py",
"category": "benchmarking"
}
,{
"name": "SpinnerTest",
"publisher": "ACME Inc",
"short_description": "Testing on-display spinner animations",
"long_description": "Stress testing multiple concurrent animations on the display by adding more and more spinners",
"icon_url": "http://demo.lnpiggy.com:2121/apps/com.example.lvgltest_0.0.1.mpk_icon_64x64.png",
"download_url": "http://demo.lnpiggy.com:2121/apps/com.example.lvgltest_0.0.1.mpk",
"fullname": "com.example.lvgltest",
"version": "0.0.1",
"entrypoint": "assets/lvgltest.py",
"category": "benchmarking"
}
,{
"name": "Memory Tester",
"publisher": "ACME Inc",
"short_description": "RAM Memory Test",
"long_description": "Experimentally determines how many RAM memory buffers can be allocated.",
"icon_url": "http://demo.lnpiggy.com:2121/apps/com.example.memtest_0.0.1.mpk_icon_64x64.png",
"download_url": "http://demo.lnpiggy.com:2121/apps/com.example.memtest_0.0.1.mpk",
"fullname": "com.example.memtest",
"version": "0.0.1",
"entrypoint": "assets/memtest.py",
"category": "benchmarking"
}
,{
"name": "AppStore",
"publisher": "ACME Inc",
"short_description": "Store for App(lication)s",
"long_description": "",
"icon_url": "http://demo.lnpiggy.com:2121/apps/com.example.appstore_0.0.2.mpk_icon_64x64.png",
"download_url": "http://demo.lnpiggy.com:2121/apps/com.example.appstore_0.0.2.mpk",
"fullname": "com.example.appstore",
"version": "0.0.2",
"entrypoint": "assets/appstore.py",
"category": "appstore"
}
,{
"name": "Launcher",
"publisher": "ACME Inc",
"short_description": "Simple launcher to start apps.",
"long_description": "",
"icon_url": "http://demo.lnpiggy.com:2121/apps/com.example.launcher_0.0.2.mpk_icon_64x64.png",
"download_url": "http://demo.lnpiggy.com:2121/apps/com.example.launcher_0.0.2.mpk",
"fullname": "com.example.launcher",
"version": "0.0.2",
"entrypoint": "assets/launcher.py",
"category": "launcher"
}
,{
"name": "OSUpdate",
"publisher": "ACME Inc",
"short_description": "Operating System Updater",
"long_description": "",
"icon_url": "http://demo.lnpiggy.com:2121/apps/com.example.osupdate_0.0.2.mpk_icon_64x64.png",
"download_url": "http://demo.lnpiggy.com:2121/apps/com.example.osupdate_0.0.2.mpk",
"fullname": "com.example.osupdate",
"version": "0.0.2",
"entrypoint": "assets/osupdate.py",
"category": "osupdate"
}
,{
"name": "WiFiConf",
"publisher": "ACME Inc",
"short_description": "Wireless Network Configuration",
"long_description": "",
"icon_url": "http://demo.lnpiggy.com:2121/apps/com.example.wificonf_0.0.2.mpk_icon_64x64.png",
"download_url": "http://demo.lnpiggy.com:2121/apps/com.example.wificonf_0.0.2.mpk",
"fullname": "com.example.wificonf",
"version": "0.0.2",
"entrypoint": "assets/wificonf.py",
"category": "wificonf"
}
]
-5
View File
@@ -1,5 +0,0 @@
{
"version": "0.0.4",
"download_url": "https://updates.micropythonos.com/releases/Waveshare/ESP32-S3-Touch-LCD-2/Waveshare_ESP32-S3-Touch-LCD-2_0.0.4.bin",
"changelog": "- Add left edge swipe gesture for back screen action\n- Add animations\n- Add support for QR decoding by porting quirc\n- Add support for Nostr by porting python-nostr\n- Add support for Websockets by porting websocket-client's WebSocketApp \n- Add support for secp256k1 with ecdh by porting and extending secp256k1-embedded\n- Change theme from dark to light\n- Improve display refresh rate\n- Fix aiohttp_ws bug that caused partial websocket data reception\n- Add support for on Linux desktop\n- Add support for VideoForLinux2 devices (webcams etc) on Linux\n- Improve builtin apps: Launcher, WiFi, AppStore and OSUpdate"
}
-197
View File
@@ -1,197 +0,0 @@
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <unistd.h>
#include <sys/ioctl.h>
#include <linux/videodev2.h>
#include <sys/mman.h>
#include <string.h>
#include <errno.h>
#define WIDTH 640
#define HEIGHT 480
#define NUM_BUFFERS 4
#define OUTPUT_WIDTH 240
#define OUTPUT_HEIGHT 240
// Global variables
int fd = -1;
struct v4l2_buffer buf;
void *buffers[NUM_BUFFERS];
size_t buffer_length;
// Convert YUYV to grayscale and downscale to 240x240
void yuyv_to_grayscale_240x240(unsigned char *yuyv, unsigned char *gray, int in_width, int in_height) {
// Downscale factors
float x_ratio = (float)in_width / OUTPUT_WIDTH;
float y_ratio = (float)in_height / OUTPUT_HEIGHT;
for (int y = 0; y < OUTPUT_HEIGHT; y++) {
for (int x = 0; x < OUTPUT_WIDTH; x++) {
// Nearest-neighbor interpolation
int src_x = (int)(x * x_ratio);
int src_y = (int)(y * y_ratio);
int src_index = (src_y * in_width + src_x) * 2; // YUYV: 2 bytes per pixel
gray[y * OUTPUT_WIDTH + x] = yuyv[src_index]; // Use Y component for grayscale
}
}
}
// Save grayscale frame as .raw
void save_raw(const char *filename, unsigned char *data, int width, int height) {
FILE *fp = fopen(filename, "wb");
if (!fp) {
perror("Cannot open file");
return;
}
fwrite(data, 1, width * height, fp); // Write raw grayscale data
fclose(fp);
}
int init_webcam(const char *device) {
// Open device
fd = open(device, O_RDWR);
if (fd < 0) {
perror("Cannot open device");
return -1;
}
// Set format
struct v4l2_format fmt = {0};
fmt.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
fmt.fmt.pix.width = WIDTH;
fmt.fmt.pix.height = HEIGHT;
fmt.fmt.pix.pixelformat = V4L2_PIX_FMT_YUYV;
fmt.fmt.pix.field = V4L2_FIELD_ANY;
if (ioctl(fd, VIDIOC_S_FMT, &fmt) < 0) {
perror("Cannot set format");
close(fd);
return -1;
}
// Request buffers
struct v4l2_requestbuffers req = {0};
req.count = NUM_BUFFERS;
req.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
req.memory = V4L2_MEMORY_MMAP;
if (ioctl(fd, VIDIOC_REQBUFS, &req) < 0) {
perror("Cannot request buffers");
close(fd);
return -1;
}
// Map buffers
for (int i = 0; i < NUM_BUFFERS; i++) {
struct v4l2_buffer buf = {0};
buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
buf.memory = V4L2_MEMORY_MMAP;
buf.index = i;
if (ioctl(fd, VIDIOC_QUERYBUF, &buf) < 0) {
perror("Cannot query buffer");
close(fd);
return -1;
}
buffer_length = buf.length;
buffers[i] = mmap(NULL, buf.length, PROT_READ | PROT_WRITE, MAP_SHARED, fd, buf.m.offset);
if (buffers[i] == MAP_FAILED) {
perror("Cannot map buffer");
close(fd);
return -1;
}
}
// Queue buffers
for (int i = 0; i < NUM_BUFFERS; i++) {
struct v4l2_buffer buf = {0};
buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
buf.memory = V4L2_MEMORY_MMAP;
buf.index = i;
if (ioctl(fd, VIDIOC_QBUF, &buf) < 0) {
perror("Cannot queue buffer");
return -1;
}
}
// Start streaming
enum v4l2_buf_type type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
if (ioctl(fd, VIDIOC_STREAMON, &type) < 0) {
perror("Cannot start streaming");
return -1;
}
return 0;
}
void deinit_webcam() {
if (fd < 0) return;
// Stop streaming
enum v4l2_buf_type type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
ioctl(fd, VIDIOC_STREAMOFF, &type);
// Unmap buffers
for (int i = 0; i < NUM_BUFFERS; i++) {
if (buffers[i] != MAP_FAILED) {
munmap(buffers[i], buffer_length);
}
}
// Close device
close(fd);
fd = -1;
}
int capture_frame(char *filename) {
// Dequeue buffer
struct v4l2_buffer buf = {0};
buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
buf.memory = V4L2_MEMORY_MMAP;
if (ioctl(fd, VIDIOC_DQBUF, &buf) < 0) {
perror("Cannot dequeue buffer");
return -1;
}
// Convert and save frame
unsigned char *gray = malloc(OUTPUT_WIDTH * OUTPUT_HEIGHT);
yuyv_to_grayscale_240x240(buffers[buf.index], gray, WIDTH, HEIGHT);
save_raw(filename, gray, OUTPUT_WIDTH, OUTPUT_HEIGHT);
free(gray);
// Requeue buffer
if (ioctl(fd, VIDIOC_QBUF, &buf) < 0) {
perror("Cannot requeue buffer");
return -1;
}
return 0;
}
int capture_frames(int n) {
for (int i = 0; i < n; i++) {
char filename[32];
snprintf(filename, sizeof(filename), "frame_%03d.raw", i);
if (capture_frame(filename) < 0) {
printf("Failed to capture frame %d\n", i);
return -1;
}
printf("Captured frame %d to %s\n", i, filename);
}
return 0;
}
int main() {
if (init_webcam("/dev/video0") < 0) {
printf("Webcam initialization failed\n");
return -1;
}
if (capture_frames(1000) < 0) {
printf("Frame capture failed\n");
deinit_webcam();
return -1;
}
deinit_webcam();
printf("Webcam deinitialized\n");
return 0;
}