Пример #1
0
void DMXMonitor::SetData(const uint8_t nPort, const uint8_t *pData, const uint16_t nLength) {
    uint8_t row = TOP_ROW;
    uint8_t *p = (uint8_t *)pData;
    uint16_t slot = 0;
    uint8_t i, j;

    for (i = 0; (i < 16) && (slot < nLength); i++) {

        console_set_cursor(4, ++row);

        for (j = 0; (j < 32) && (slot < nLength); j++) {
            const uint8_t d = *p++;
            if (d == (uint8_t) 0) {
                console_puts(" 0");
            } else {
                console_puthex_fg_bg(d, (uint16_t)(d > 92 ? CONSOLE_BLACK : CONSOLE_WHITE), (uint16_t)RGB(d,d,d));
            }
            (void) console_putc((int) ' ');
            slot++;
        }

        for (; j < 32; j++) {
            console_puts("-- ");
        }
    }

    for (; i < 16; i++) {
        console_set_cursor(4, ++row);
        console_puts("-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --");
    }

}
Пример #2
0
void TimeCode::Start(void) {
	console_save_cursor();
	console_set_cursor(COLUMN, ROW);
	console_set_fg_color(CONSOLE_CYAN);
	console_puts(timecode);
	console_restore_cursor();
}
Пример #3
0
void DMXMonitor::Start(void) {
    for (int i = TOP_ROW; i < (TOP_ROW + 17); i++) {
        console_clear_line(i);
    }

    console_set_cursor(0, TOP_ROW);
    console_puts("    00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31\n");

    for (int i = 1; i < (int)(16 * 32) ; i = i + (int)32) {
        printf("%3d\n", i);
    }
}
Пример #4
0
void monitor_update(void) {
	// Handle Active Sensing messages
	switch (midi_get_active_sense_state()) {
	case MIDI_ACTIVE_SENSE_ENABLED:
		console_save_cursor();
		console_set_cursor(70, 3);
		console_set_fg_bg_color(CONSOLE_BLACK, CONSOLE_CYAN);
		(void) console_puts("ACTIVE SENSING          ");
		console_restore_cursor();
		break;
	case MIDI_ACTIVE_SENSE_FAILED:
		console_save_cursor();
		console_set_cursor(70, 3);
		console_set_fg_bg_color(CONSOLE_RED, CONSOLE_WHITE);
		(void) console_puts("ACTIVE SENSING - Failed!");
		console_restore_cursor();
		break;
	default:
		break;
	}
}
Пример #5
0
/**
 *
 * @param ArtNetTimeCode
 */
void TimeCode::Handler(const struct TArtNetTimeCode *ArtNetTimeCode) {
	itoa_base10(ArtNetTimeCode->Hours, (char *) &timecode[0]);
	itoa_base10(ArtNetTimeCode->Minutes, (char *) &timecode[3]);
	itoa_base10(ArtNetTimeCode->Seconds, (char *) &timecode[6]);
	itoa_base10(ArtNetTimeCode->Frames, (char *) &timecode[9]);

	if ((prev_type != ArtNetTimeCode->Type) && (ArtNetTimeCode->Type < (uint8_t) 4)) {
		memcpy((char *) &timecode[12], (char *) types[ArtNetTimeCode->Type], 5);
		prev_type = ArtNetTimeCode->Type;
	}

	console_save_cursor();
	console_set_cursor(COLUMN, ROW);
	console_set_fg_color(CONSOLE_CYAN);
	console_write(timecode, TIMECODE_LENGTH);
	console_restore_cursor();
}
Пример #6
0
void TimeCode::Stop(void) {
	console_set_cursor(COLUMN, ROW);
	console_puts("                 ");
}
Пример #7
0
void
console_reset(void)
{
    screen_clear();
    console_set_cursor(0, 0);
}
Пример #8
0
void notmain(void) {
	hardware_init();

	ltc_reader_params_init();

	output.console_output = ltc_reader_params_is_console_output();
	output.lcd_output = ltc_reader_params_is_lcd_output();
	output.midi_output = ltc_reader_params_is_midi_output();
	output.artnet_output = ltc_reader_params_is_artnet_output();

	if(output.midi_output) {
		midi_send_init();
	}

	if (output.lcd_output) {
		output.lcd_output = lcd_detect();
	}

	if (output.artnet_output) {
		output.artnet_output = wifi_detect();
	}

	ltc_reader_init(&output);

	printf("[V%s] %s Compiled on %s at %s\n", SOFTWARE_VERSION, hardware_board_get_model(), __DATE__, __TIME__);
	printf("SMPTE TimeCode LTC Reader / Converter");

	console_set_top_row(3);

	console_set_cursor(0, 12);
	console_puts("Console output : "); handle_bool(output.console_output); console_putc('\n');
	console_puts("LCD output     : "); handle_bool(output.lcd_output); console_putc('\n');
	console_puts("MIDI output    : "); handle_bool(output.midi_output); console_putc('\n');
	console_puts("ArtNet output  : "); handle_bool(output.artnet_output);console_puts(" (not implemented)\n");

	if (output.artnet_output) {
		uint8_t mac_address[6];
		struct ip_info ip_config;

		(void) ap_params_init();
		const char *ap_password = ap_params_get_password();

		console_status(CONSOLE_YELLOW, "Starting Wifi ...");

		wifi_init(ap_password);

		printf("\nESP8266 information\n");
		printf(" SDK      : %s\n", system_get_sdk_version());
		printf(" Firmware : %s\n\n", wifi_get_firmware_version());

		if (network_params_init()) {
			console_status(CONSOLE_YELLOW, "Changing to Station mode ...");
			if (network_params_is_use_dhcp()) {
				wifi_station(network_params_get_ssid(), network_params_get_password());
			} else {
				ip_config.ip.addr = network_params_get_ip_address();
				ip_config.netmask.addr = network_params_get_net_mask();
				ip_config.gw.addr = network_params_get_default_gateway();
				wifi_station_ip(network_params_get_ssid(), network_params_get_password(), &ip_config);
			}
		}

		const _wifi_mode opmode = wifi_get_opmode();

		if (opmode == WIFI_STA) {
			printf("WiFi mode : Station\n");
		} else {
			printf("WiFi mode : Access Point (authenticate mode : %s)\n", *ap_password == '\0' ? "Open" : "WPA_WPA2_PSK");
		}

		if (wifi_get_macaddr(mac_address)) {
			printf(" MAC address : "MACSTR "\n", MAC2STR(mac_address));
		} else {
			console_error("wifi_get_macaddr");
		}

		printf(" Hostname    : %s\n", wifi_station_get_hostname());

		if (wifi_get_ip_info(&ip_config)) {
			printf(" IP-address  : " IPSTR "\n", IP2STR(ip_config.ip.addr));
			printf(" Netmask     : " IPSTR "\n", IP2STR(ip_config.netmask.addr));
			printf(" Gateway     : " IPSTR "\n", IP2STR(ip_config.gw.addr));
			if (opmode == WIFI_STA) {
				const _wifi_station_status status = wifi_station_get_connect_status();
				printf("      Status : %s\n", wifi_station_status(status));
				if (status != WIFI_STATION_GOT_IP){
					console_error("Not connected!");
					for(;;);
				}
			}
		} else {
			console_error("wifi_get_ip_info");
		}

		console_status(CONSOLE_YELLOW, "Starting UDP ...");
		udp_begin(6454);

		console_status(CONSOLE_GREEN, "Wifi is started");
	}

	for (;;) {
		ltc_reader();
	}
}