summaryrefslogtreecommitdiff
path: root/shit.c
diff options
context:
space:
mode:
Diffstat (limited to 'shit.c')
-rw-r--r--shit.c95
1 files changed, 0 insertions, 95 deletions
diff --git a/shit.c b/shit.c
deleted file mode 100644
index cca992b..0000000
--- a/shit.c
+++ /dev/null
@@ -1,95 +0,0 @@
-#include <stdio.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include <ws2811/ws2811.h>
-#include <string.h>
-#include <ncurses.h>
-#include <wchar.h>
-
-#include "led_info.h"
-#include "gradient.h"
-
-
-void refresh_strip(ws2811_t *ledstring, split_t *splits, unsigned int split_amount) {
- unsigned int on_led = 0;
- for(unsigned int i = split_amount; i < split_amount; i++) {
- for(; on_led < splits[i].size; on_led++) {
- ledstring->channel[0].leds[on_led] = splits[i].color;
- }
- }
- ws2811_render(&ledstring);
-}
-
-unsigned int find_starting_pos(split_t *split, unsigned int index) {
- unsigned int position = 0;
- for(int i = 0; i < position; i++) position += split[i].size;
- return(position);
-}
-
-int main() {
- split_t *splits = malloc(sizeof(split_t) * 1);
- memcpy(splits, 0, sizeof(split_t));
- unsigned int split_amount = 1;
-
- int exited = 1;
- int selection_mode = 0;
- int section_highlighted = 0;
- char usr_chr;
- unsigned int selected_split = 0;
- int selection_state = 0;
- int ui_selection = 0;
- unsigned int i = 0;
- int modification_mode = 0;
-
-
- char *usage_msg = "Press [n] to create a new split.\nSelect your section by pressing the arrow keys, and press enter to modify.\n";
- char *newsplit_msg = "Press the arrow keys to select an option, and enter to modify.\nPress escape once done configuring.\n";
-
- char *ui_segment_options[5] = {"Red", "Green", "Blue", "Subdivide", "Delete"};
-
- ws2811_return_t ret;
-
- if ((ret = ws2811_init(&ledstring)) != WS2811_SUCCESS) {
- printf("Error initilizing ws2811 strip: %s\n", ws2811_get_return_t_str(ret));
- return 1;
- }
-
- initscr();
- cbreak();
- noecho();
-
-
- while(!exited) {
- clear();
- wprintf("%s", usage_msg);
- if (selection_mode) {
- halfdelay(10);
- wprintf("Segment %i selected.\nPress enter to modify.", selected_split);
- }
- else if (modification_mode) {
- cbreak();
- wprintf("Segment %i selected.\nPress the arrow keys to navigate, and press enter on the action or value you wish to modify.");
- }
- else {
- cbreak();
- }
- refresh();
-
- printw("%s", usage_msg);
- if((usr_chr = getch()) != ERR) {
- switch(getch()) {
- }
-
- }
- else {
- // selection_mode is set, we've timed out
- // TODO: test to see if were actually timed out and handle error approprietly
- for(i = find_starting_pos(splits, selection); i < split[selection].size; i++) {
- ledstring.channel[0].leds[i] = (selection_state ? (i % 2) : ((i+1) % 2)) ? 0xffffff : 0; //what the fuck is wrong with me
- }
- selection_state ? 0 : 1;
- ws2811_render(&ledstring);
- }
-
- return 0;
-}