Esempio n. 1
0
static void set_help_text (void)
{
	const app_context_t * a = current_app;
	
	vd_clear_rect(help_layer, 0, 0, 40, 6); // name
	vd_prints_xy(help_layer, 0, 0, VDISP_FONT_4x6, 0, a->name);
	
	vd_clear_rect(help_layer, 0, 58, 25, 6); // button 1
	vd_prints_xy(help_layer, 0, 58, VDISP_FONT_4x6, 0, a->button_text[0]);
	
	vd_clear_rect(help_layer, 34, 58, 24, 6); // button 2
	vd_prints_xy(help_layer, 34, 58, VDISP_FONT_4x6, 0, a->button_text[1]);
	
	vd_clear_rect(help_layer, 66, 58, 24, 6); // button 3
	vd_prints_xy(help_layer, 66, 58, VDISP_FONT_4x6, 0, a->button_text[2]);
	
	vd_clear_rect(help_layer, 98, 58, 24, 6); // button 4
	vd_prints_xy(help_layer, 98, 58, VDISP_FONT_4x6, 0, a->button_text[3]);
	
	/*
	vd_clear_rect(help_layer, 91, 14, 32, 6); // button UP
	vd_prints_xy(help_layer, 91, 14, VDISP_FONT_4x6, 0, a->button_text[3]);
	
	vd_clear_rect(help_layer, 91, 38, 32, 6); // button DOWN
	vd_prints_xy(help_layer, 91, 38, VDISP_FONT_4x6, 0, a->button_text[4]);
	*/
}
Esempio n. 2
0
static void set_speaker_volume (int up)
{
	int new_volume = SETTING_CHAR(C_SPKR_VOLUME) + ( up ? 1 : -1 );
	
	if ((new_volume <= 6) && (new_volume >= -57))
	{
		SETTING_CHAR(C_SPKR_VOLUME) = new_volume;
		
		char buf[4];
		
		if (new_volume < 0)
		{
			new_volume = -new_volume;
			buf[0] = '-';
		}
		else
		{
			buf[0] = '+';
		}
		
		lcd_show_menu_layer(help_layer);
		help_layer_timer = 0; // display permanent
		
		vd_clear_rect(help_layer, 0, 12, 146, 43);

		vdisp_i2s(buf + 1, 2, 10, 1, new_volume);
		vd_prints_xy(help_layer, 30, 30, VDISP_FONT_6x8, 0, "Volume");
		vd_prints_xy(help_layer, 70, 30, VDISP_FONT_6x8, 0, buf);
		
		lcd_show_help_layer(help_layer);
		help_layer_timer = 3; // approx 2 seconds
	}
}
Esempio n. 3
0
static void ref_print_status (void)
{
	
	vd_prints_xy(VDISP_REF_LAYER, 36, 12, VDISP_FONT_6x8, (ref_selected_item == 0),
		ref_modes[(int) ref_items[0]]);
	
	#define XPOS_NODEINFO_LAYER 10
	vd_prints_xy(VDISP_REF_LAYER, XPOS_NODEINFO_LAYER, 24, VDISP_FONT_6x8, (ref_selected_item == 1),
		ref_types[(int) ref_items[1]]);
	
	vd_printc_xy(VDISP_REF_LAYER, XPOS_NODEINFO_LAYER + 3*6, 24, VDISP_FONT_6x8, (ref_selected_item == 2),
		ref_items[2] + 0x30);
	vd_printc_xy(VDISP_REF_LAYER, XPOS_NODEINFO_LAYER + 4*6, 24, VDISP_FONT_6x8, (ref_selected_item == 3),
		ref_items[3] + 0x30);
	vd_printc_xy(VDISP_REF_LAYER, XPOS_NODEINFO_LAYER + 5*6, 24, VDISP_FONT_6x8, (ref_selected_item == 4),
		ref_items[4] + 0x30);
	
	vd_printc_xy(VDISP_REF_LAYER, XPOS_NODEINFO_LAYER + 6*6, 24, VDISP_FONT_6x8, (ref_selected_item == 5),
		0x20);
	vd_printc_xy(VDISP_REF_LAYER, XPOS_NODEINFO_LAYER + 7*6, 24, VDISP_FONT_6x8, (ref_selected_item == 5),
		ref_items[5] + 0x41);
	vd_printc_xy(VDISP_REF_LAYER, XPOS_NODEINFO_LAYER + 8*6, 24, VDISP_FONT_6x8, (ref_selected_item == 5),
		0x20);
		
	vd_clear_rect(VDISP_REF_LAYER, 0, 36, 120, 12);

	if (repeater_mode || hotspot_mode)
	{
		vd_prints_xy(VDISP_REF_LAYER, 0, 36, VDISP_FONT_6x8, 0, "Hometimer");
	
		vd_prints_xy(VDISP_REF_LAYER, 60, 36, VDISP_FONT_6x8, (ref_selected_item == 6),
			ref_timer[(int) ref_items[6]]);
	}
	
	#undef XPOS
}
Esempio n. 4
0
void rmuset_print(void)
{
	char str[RMUSET_LINE_LENGTH];
	
	vd_clear_rect(VDISP_RMUSET_LAYER, 0, 12, 146, 43);
	
	vd_printc_xy(VDISP_RMUSET_LAYER, 120, 13, VDISP_FONT_8x12, 0, 0x1e); // arrow up
	vd_printc_xy(VDISP_RMUSET_LAYER, 120, 39, VDISP_FONT_8x12, 0, 0x1f); // arrow up
	
	vd_prints_xy(VDISP_RMUSET_LAYER, 0, 12, VDISP_FONT_5x8, 0, "TX-QRG:");
	vd_prints_xy(VDISP_RMUSET_LAYER, 0, 23, VDISP_FONT_5x8, 0, "RX-QRG:");


	vd_prints_xy(VDISP_RMUSET_LAYER, 93, 12, VDISP_FONT_5x8, 0, "MHz");
	vd_prints_xy(VDISP_RMUSET_LAYER, 93, 23, VDISP_FONT_5x8, 0, "MHz");
	
	if (!rmuset_enabled())
	{
		vd_prints_xy(VDISP_RMUSET_LAYER, 40, 12, VDISP_FONT_5x8, 0, "---.---.--");
		vd_prints_xy(VDISP_RMUSET_LAYER, 40, 23, VDISP_FONT_5x8, 0, "---.---.--");
		
		feld_selected_item = 6;
		enabled_invers = 1;
	}
	else
	{
		memset(str, '\0', RMUSET_LINE_LENGTH);
		memcpy(str, settings.s.qrg_tx, 3);
		vd_prints_xy(VDISP_RMUSET_LAYER, 39, 12, VDISP_FONT_5x8, tx_qrg_MHz_invers, str);
		vd_prints_xy(VDISP_RMUSET_LAYER, 54, 12, VDISP_FONT_5x8, 0, ".");
	
		memset(str, '\0', RMUSET_LINE_LENGTH);
		memcpy(str, settings.s.qrg_tx + 3, 1);
		vd_prints_xy(VDISP_RMUSET_LAYER, 59, 12, VDISP_FONT_5x8, tx_qrg_100kHz_invers, str);
	
		memset(str, '\0', RMUSET_LINE_LENGTH);
		memcpy(str, settings.s.qrg_tx + 4, 2);
		vd_prints_xy(VDISP_RMUSET_LAYER, 65, 12, VDISP_FONT_5x8, tx_qrg_6_25kHz_invers, str);

		memset(str, '\0', RMUSET_LINE_LENGTH);
		memcpy(str, ".", 1);
		memcpy(str + 1, settings.s.qrg_tx + 6, 2);
		vd_prints_xy(VDISP_RMUSET_LAYER, 75, 12, VDISP_FONT_5x8, tx_qrg_6_25kHz_invers, str);

		memset(str, '\0', RMUSET_LINE_LENGTH);
		memcpy(str, settings.s.qrg_rx, 3);
		vd_prints_xy(VDISP_RMUSET_LAYER, 39, 23, VDISP_FONT_5x8, rx_qrg_MHz_invers, str);
		vd_prints_xy(VDISP_RMUSET_LAYER, 54, 23, VDISP_FONT_5x8, 0, ".");
	
		memset(str, '\0', RMUSET_LINE_LENGTH);
		memcpy(str, settings.s.qrg_rx + 3, 1);
		vd_prints_xy(VDISP_RMUSET_LAYER, 59, 23, VDISP_FONT_5x8, rx_qrg_100kHz_invers, str);
	
		memset(str, '\0', RMUSET_LINE_LENGTH);
		memcpy(str, settings.s.qrg_rx + 4, 2);
		vd_prints_xy(VDISP_RMUSET_LAYER, 65, 23, VDISP_FONT_5x8, rx_qrg_6_25kHz_invers, str);

		memset(str, '\0', RMUSET_LINE_LENGTH);
		memcpy(str, ".", 1);
		memcpy(str + 1, settings.s.qrg_rx + 6, 2);
		vd_prints_xy(VDISP_RMUSET_LAYER, 75, 23, VDISP_FONT_5x8, rx_qrg_6_25kHz_invers, str);
	}
		
	vd_prints_xy(VDISP_RMUSET_LAYER, 40, 35, VDISP_FONT_5x8, enabled_invers, ref_enabled[rmuset_enabled()]);
}
Esempio n. 5
0
int dns2_req_A (const char * name)
{
	
	int i;
	int handle = -1;
	int link_zero_slot = -1;
	int ttl_min = 65535;
	
	for (i=0; i < DNS_NUMBER_OF_ENTRIES; i++)
	{
		struct dns2_cache * cur = dc + i;
		
		if (cur->reqname_len == 0)
		{
			handle = i; // free slot
			break;
		}
		
		if (cur->link == 0) // slot currently not in use
		{
			if (cur->ttl < ttl_min)
			{
				ttl_min = cur->ttl;
				link_zero_slot = i; // unused slot with the lowest TTL
			}
		}
	}
	
	if (handle < 0)
	{
		if (link_zero_slot < 0) // could not find slot that is not in use
			return -1; // no free slots
	
		handle = link_zero_slot; // use entry with smallest ttl left	
	}
	
	if (dns2_parse_domain(handle, name) != 0)
	{
		return -1;  // something wrong with the requested name
	}
	
	struct dns2_cache * cur = dc + handle;
	
	for (i=0; i < DNS_NUMBER_OF_ENTRIES; i++)
	{		
		if (i == handle) // skip the newly created entry
			continue;
		
		struct dns2_cache * cached = dc + i;
		
		if (cur->reqname_len == cached->reqname_len)
		{
			if ((memcmp(cur->reqname, cached->reqname, cached->reqname_len) == 0)
				&& (cached->ttl > 0))
			{  // same name requested and some TTL left
				cached->link ++;
				cur->reqname_len = 0; // free the newly created handle
				return i; // return the cached handle 
			}
		}
	}
	
	if (strcmp(name, "tst002.reflector.up4dar.de") == 0)
	{
		memcpy (cur->result_data, tst002addr, sizeof tst002addr);
		cur->result_data_len = sizeof tst002addr;
		cur->state = DNS_STATE_RESULT_OK;
		cur->ttl = 5;
		cur->link = 1;
		return handle;
	}
		
	if (memcmp(ipv4_dns_pri, ipv4_zero_addr, sizeof ipv4_addr) == 0)
	{  // no primary DNS server
		return -1;
	}
		
	cur->retry = DNS_REQ_RETRY;
	cur->timeout = 0;
	cur->primary_server = 1; // begin with primary server
	cur->link = 1; // one client links to this
	cur->state = DNS_STATE_REQ_A;
	cur->udp_local_port = 0; // select new port
	
	vd_prints_xy(VDISP_DEBUG_LAYER, 0, 48, VDISP_FONT_4x6, 0, "AREQ");
	vd_prints_xy(VDISP_DEBUG_LAYER, 20, 48, VDISP_FONT_4x6, 0, name);
	vd_clear_rect(VDISP_DEBUG_LAYER, 0, 54, 80, 6);
	return handle; // OK
}
Esempio n. 6
0
static void recv_gpgsv(int num_sats)
{
	int total = get_nmea_num(1);
	int msgnum = get_nmea_num(2);
	
	if (msgnum == 1) // first msg
	{
		gps_init_satlist();  // clear list
	}
	
	
	
	int j;
	int i;
	
	for (i=0; i < num_sats; i++)
	{
		int s_ptr = i + ((msgnum - 1) << 2);
		
		if (s_ptr < MAX_SATELLITES)
		{
			if ( (*(nmea_params[ 4 + i * 4 ])) == 0) // empty parameter
			{
				sats[s_ptr].sat_id = NO_SAT;
			}
			else
			{
				sats[s_ptr].sat_id = get_nmea_num( 4 + i * 4 );
				sats[s_ptr].elevation = get_nmea_num( 5 + i * 4 );
				sats[s_ptr].azimuth = get_nmea_num( 6 + i * 4 );
				sats[s_ptr].snr = get_nmea_num( 7 + i * 4 );
			}
			
		}
	}

	if (msgnum == total) // last record, print it
	{
		vd_clear_rect (VDISP_GPS_LAYER, 0, 0, 128, 64);
		
		
		if (gps_fix >= 2)
		{
			buf[0] = 0x30 + gps_fix;
			buf[1] = 0;
			
			vd_prints_xy(VDISP_GPS_LAYER, 62, 46, VDISP_FONT_4x6, 0, buf);
			vd_prints_xy(VDISP_GPS_LAYER, 66, 46, VDISP_FONT_4x6, 0, "D FIX");
		}
		else
		{
			vd_prints_xy(VDISP_GPS_LAYER, 62, 46, VDISP_FONT_4x6, 0, "NO FIX");
		}
		
		/*
		if (gpgga_fix_info > 0)
		{
			buf[0] = 0x30 + gpgga_fix_info;
			buf[1] = 0;
			
			vd_prints_xy(VDISP_GPS_LAYER, 0, 56, VDISP_FONT_6x8, 0, buf);
		}
		else
		{
			vd_prints_xy(VDISP_GPS_LAYER, 0, 56, VDISP_FONT_6x8, 0, "-");
		}
		
		if (gprmc_fix_mode > 0)
		{
			buf[0] = gprmc_fix_mode;
			buf[1] = 0;
			
			vd_prints_xy(VDISP_GPS_LAYER, 6, 0, VDISP_FONT_6x8, 0, buf);
		}
		else
		{
			vd_prints_xy(VDISP_GPS_LAYER, 6, 0, VDISP_FONT_6x8, 0, "-");
		}
		
		if (gprmc_status > 0)
		{
			buf[0] = gprmc_status;
			buf[1] = 0;
			
			vd_prints_xy(VDISP_GPS_LAYER, 12, 0, VDISP_FONT_6x8, 0, buf);
		}
		else
		{
			vd_prints_xy(VDISP_GPS_LAYER, 12, 0, VDISP_FONT_6x8, 0, "-");
		}
		*/
		
		/*
		for (i=0; i < 360; i+= 45)
		{
			vd_set_pixel(VDISP_GPS_LAYER, 32 + (fixpoint_sin(i) / 700),
				32 + (fixpoint_cos(i) / 700), 0, 1, 1);
		}
		*/
		
		for (i=0; i < 360; i+= 10)
		{
			vd_set_pixel(VDISP_GPS_LAYER, 32 + (fixpoint_sin(i) / 357),
				32 + (fixpoint_cos(i) / 357), 0, 1, 1);
		}			
				
		vd_prints_xy(VDISP_GPS_LAYER, 0, 28, VDISP_FONT_6x8, 0, "W");
		vd_prints_xy(VDISP_GPS_LAYER, 58, 28, VDISP_FONT_6x8, 0, "E");
		vd_prints_xy(VDISP_GPS_LAYER, 29, 0, VDISP_FONT_6x8, 0, "N");
		vd_prints_xy(VDISP_GPS_LAYER, 29, 56, VDISP_FONT_6x8, 0, "S");
		
		
		for (i=0; i < MAX_SATELLITES; i++)
		{
			if (sats[i].sat_id != NO_SAT)
			{
				int x = 120 - (i % 6) * 10;
				int y = (i / 6) * 21;
				
				
				
				int used_in_fix = 0;
				
				for (j=0; j < GPGSA_NUM_DATA; j++)
				{
					if (sats[i].sat_id == gpgsa_data[j])
					{
						used_in_fix = 1;
					}
				}
				
				if (sats[i].elevation > 0)
				{
					int xx = 28 + fixpoint_cos(sats[i].elevation) * fixpoint_sin(sats[i].azimuth) / 3570000;
					int yy = 29 - fixpoint_cos(sats[i].elevation) * fixpoint_cos(sats[i].azimuth) / 3570000;
					
					vdisp_i2s(buf, 2, 10, 1, sats[i].sat_id);
					vd_prints_xy(VDISP_GPS_LAYER, xx, yy+1, VDISP_FONT_4x6, used_in_fix, buf);
					
					for (j=0; j < 8; j++)
					{
						vd_set_pixel(VDISP_GPS_LAYER, xx + j, yy, 0, used_in_fix, 1);
					}
					
					for (j=0; j < 7; j++)
					{
						vd_set_pixel(VDISP_GPS_LAYER, xx + 8, yy + j, 0, used_in_fix, 1);
					}
				}
				
				vdisp_i2s(buf, 2, 10, 1, sats[i].sat_id);
				vd_prints_xy(VDISP_GPS_LAYER, x, y + 14, VDISP_FONT_4x6, 0, buf);
				
				int v = fixpoint_sin(sats[i].snr) / 833;
				
				vd_set_pixel(VDISP_GPS_LAYER, x+1, y + 12, 0, 0x7F, 7);
				
				for (j=1; j < v; j++)
				{
					vd_set_pixel(VDISP_GPS_LAYER, x+1, y + 12 - j, 0,
						used_in_fix ? 0x7F : 0x41 , 7);
				}
				
				vd_set_pixel(VDISP_GPS_LAYER, x+1, y + 12 - v, 0, 0x7F, 7);
				
				/*
				vdisp_i2s(buf, 3, 10, 1, sats[i].sat_id);
				vd_prints_xy(VDISP_GPS_LAYER, x +  0, y, VDISP_FONT_4x6, used_in_fix, buf);
			
				vdisp_i2s(buf, 2, 10, 1, sats[i].elevation);
				vd_prints_xy(VDISP_GPS_LAYER, x + 16, y, VDISP_FONT_4x6, 0, buf);	
				
				vdisp_i2s(buf, 3, 10, 1, sats[i].azimuth);
				vd_prints_xy(VDISP_GPS_LAYER, x + 28, y, VDISP_FONT_4x6, 0, buf);
				
				vdisp_i2s(buf, 2, 10, 1, sats[i].snr);
				vd_prints_xy(VDISP_GPS_LAYER, x + 44, y, VDISP_FONT_4x6, 0, buf);	
				
				*/
			}
		}
		
		
	}
	
	
	for (i=0; i < 2; i++)
	{
		vd_prints_xy(VDISP_GPS_LAYER, 56, 52 + (i*6), VDISP_FONT_4x6, 0, fix_data[i]);
	}	
	
	
	/*
	vdisp_i2s(buf, 2, 10, 1, get_nmea_num(1));
	vd_prints_xy(VDISP_GPS_LAYER, 0, 58, VDISP_FONT_4x6, 0, buf);
	vdisp_i2s(buf, 2, 10, 1, get_nmea_num(2));
	vd_prints_xy(VDISP_GPS_LAYER, 12, 58, VDISP_FONT_4x6, 0, buf);
	vdisp_i2s(buf, 2, 10, 1, get_nmea_num(3));
	vd_prints_xy(VDISP_GPS_LAYER, 24, 58, VDISP_FONT_4x6, 0, buf);
	*/
}
Esempio n. 7
0
void nodeinfo_print(void)
{
	char str[NODEINFO_LINE_LENGTH];
	
	vd_clear_rect(VDISP_NODEINFO_LAYER, 0, 12, 146, 43);
	
	vd_printc_xy(VDISP_NODEINFO_LAYER, 120, 13, VDISP_FONT_8x12, 0, 0x1e); // arrow up
	vd_printc_xy(VDISP_NODEINFO_LAYER, 120, 39, VDISP_FONT_8x12, 0, 0x1f); // arrow up
	
	vd_prints_xy(VDISP_NODEINFO_LAYER, 0, 12, VDISP_FONT_5x8, 0, "LAT:");
	vd_prints_xy(VDISP_NODEINFO_LAYER, 0, 22, VDISP_FONT_5x8, 0, "LON:");
	vd_prints_xy(VDISP_NODEINFO_LAYER, 0, 32, VDISP_FONT_5x8, 0, "QRG:");
	vd_prints_xy(VDISP_NODEINFO_LAYER, 0, 42, VDISP_FONT_5x8, 0, "DUP:");
	
	memset(str, '\0', NODEINFO_LINE_LENGTH);
	memcpy(str, settings.s.node_pos_lat, 1);
	vd_prints_xy(VDISP_NODEINFO_LAYER, XPOS_NODEINFO_LAYER, 12, VDISP_FONT_5x8, (nodeinfo_pos == 0), str);
	
	memset(str, '\0', NODEINFO_LINE_LENGTH);
	memcpy(str, settings.s.node_pos_lat + 1, 1);
	vd_prints_xy(VDISP_NODEINFO_LAYER, XPOS_NODEINFO_LAYER + 1 * 5, 12, VDISP_FONT_5x8, (nodeinfo_pos == 1), str);
	vd_prints_xy(VDISP_NODEINFO_LAYER, XPOS_NODEINFO_LAYER + 2 * 5, 12, VDISP_FONT_5x8, 0, ".");
	
	memset(str, '\0', NODEINFO_LINE_LENGTH);
	memcpy(str, settings.s.node_pos_lat + 2, 1);
	vd_prints_xy(VDISP_NODEINFO_LAYER, XPOS_NODEINFO_LAYER + 3 * 5, 12, VDISP_FONT_5x8, (nodeinfo_pos == 2), str);
	
	memset(str, '\0', NODEINFO_LINE_LENGTH);
	memcpy(str, settings.s.node_pos_lat + 3, 1);
	vd_prints_xy(VDISP_NODEINFO_LAYER, XPOS_NODEINFO_LAYER + 4 * 5, 12, VDISP_FONT_5x8, (nodeinfo_pos == 3), str);
	
	memset(str, '\0', NODEINFO_LINE_LENGTH);
	memcpy(str, settings.s.node_pos_lat + 4, 1);
	vd_prints_xy(VDISP_NODEINFO_LAYER, XPOS_NODEINFO_LAYER + 5 * 5, 12, VDISP_FONT_5x8, (nodeinfo_pos == 4), str);
	
	memset(str, '\0', NODEINFO_LINE_LENGTH);
	memcpy(str, settings.s.node_pos_lat + 5, 1);
	vd_prints_xy(VDISP_NODEINFO_LAYER, XPOS_NODEINFO_LAYER + 6 * 5, 12, VDISP_FONT_5x8, (nodeinfo_pos == 5), str);

	memset(str, '\0', NODEINFO_LINE_LENGTH);
	memcpy(str, settings.s.node_pos_lon, 1);
	vd_prints_xy(VDISP_NODEINFO_LAYER, XPOS_NODEINFO_LAYER, 22, VDISP_FONT_5x8, (nodeinfo_pos == 6), str);
	
	memset(str, '\0', NODEINFO_LINE_LENGTH);
	memcpy(str, settings.s.node_pos_lon + 1, 1);
	vd_prints_xy(VDISP_NODEINFO_LAYER, XPOS_NODEINFO_LAYER + 1 * 5, 22, VDISP_FONT_5x8, (nodeinfo_pos == 7), str);
	vd_prints_xy(VDISP_NODEINFO_LAYER, XPOS_NODEINFO_LAYER + 2 * 5, 22, VDISP_FONT_5x8, 0, ".");
	
	memset(str, '\0', NODEINFO_LINE_LENGTH);
	memcpy(str, settings.s.node_pos_lon + 2, 1);
	vd_prints_xy(VDISP_NODEINFO_LAYER, XPOS_NODEINFO_LAYER + 3 * 5, 22, VDISP_FONT_5x8, (nodeinfo_pos == 8), str);
	
	memset(str, '\0', NODEINFO_LINE_LENGTH);
	memcpy(str, settings.s.node_pos_lon + 3, 1);
	vd_prints_xy(VDISP_NODEINFO_LAYER, XPOS_NODEINFO_LAYER + 4 * 5, 22, VDISP_FONT_5x8, (nodeinfo_pos == 9), str);
	
	memset(str, '\0', NODEINFO_LINE_LENGTH);
	memcpy(str, settings.s.node_pos_lon + 4, 1);
	vd_prints_xy(VDISP_NODEINFO_LAYER, XPOS_NODEINFO_LAYER + 5 * 5, 22, VDISP_FONT_5x8, (nodeinfo_pos == 10), str);
	
	memset(str, '\0', NODEINFO_LINE_LENGTH);
	memcpy(str, settings.s.node_pos_lon + 5, 1);
	vd_prints_xy(VDISP_NODEINFO_LAYER, XPOS_NODEINFO_LAYER + 6 * 5, 22, VDISP_FONT_5x8, (nodeinfo_pos == 11), str);

	memset(str, '\0', NODEINFO_LINE_LENGTH);
	memcpy(str, settings.s.node_qrg, 1);
	vd_prints_xy(VDISP_NODEINFO_LAYER, XPOS_NODEINFO_LAYER, 32, VDISP_FONT_5x8, (nodeinfo_pos == 12), str);
	
	memset(str, '\0', NODEINFO_LINE_LENGTH);
	memcpy(str, settings.s.node_qrg + 1, 1);
	vd_prints_xy(VDISP_NODEINFO_LAYER, XPOS_NODEINFO_LAYER + 1 * 5, 32, VDISP_FONT_5x8, (nodeinfo_pos == 13), str);

	memset(str, '\0', NODEINFO_LINE_LENGTH);
	memcpy(str, settings.s.node_qrg + 2, 1);
	vd_prints_xy(VDISP_NODEINFO_LAYER, XPOS_NODEINFO_LAYER + 2 * 5, 32, VDISP_FONT_5x8, (nodeinfo_pos == 14), str);
	vd_prints_xy(VDISP_NODEINFO_LAYER, XPOS_NODEINFO_LAYER + 3 * 5, 32, VDISP_FONT_5x8, 0, ".");

	memset(str, '\0', NODEINFO_LINE_LENGTH);
	memcpy(str, settings.s.node_qrg + 3, 1);
	vd_prints_xy(VDISP_NODEINFO_LAYER, XPOS_NODEINFO_LAYER + 4 * 5, 32, VDISP_FONT_5x8, (nodeinfo_pos == 15), str);

	memset(str, '\0', NODEINFO_LINE_LENGTH);
	memcpy(str, settings.s.node_qrg + 4, 1);
	vd_prints_xy(VDISP_NODEINFO_LAYER, XPOS_NODEINFO_LAYER + 5 * 5, 32, VDISP_FONT_5x8, (nodeinfo_pos == 16), str);

	memset(str, '\0', NODEINFO_LINE_LENGTH);
	memcpy(str, settings.s.node_qrg + 5, 1);
	vd_prints_xy(VDISP_NODEINFO_LAYER, XPOS_NODEINFO_LAYER + 6 * 5, 32, VDISP_FONT_5x8, (nodeinfo_pos == 17), str);

	memset(str, '\0', NODEINFO_LINE_LENGTH);
	memcpy(str, settings.s.node_dup, 1);
	vd_prints_xy(VDISP_NODEINFO_LAYER, XPOS_NODEINFO_LAYER, 42, VDISP_FONT_5x8, (nodeinfo_pos == 18), str);
	
	memset(str, '\0', NODEINFO_LINE_LENGTH);
	memcpy(str, settings.s.node_dup + 1, 1);
	vd_prints_xy(VDISP_NODEINFO_LAYER, XPOS_NODEINFO_LAYER + 1 * 5, 42, VDISP_FONT_5x8, (nodeinfo_pos == 19), str);

	memset(str, '\0', NODEINFO_LINE_LENGTH);
	memcpy(str, settings.s.node_dup + 2, 1);
	vd_prints_xy(VDISP_NODEINFO_LAYER, XPOS_NODEINFO_LAYER + 2 * 5, 42, VDISP_FONT_5x8, (nodeinfo_pos == 20), str);
	vd_prints_xy(VDISP_NODEINFO_LAYER, XPOS_NODEINFO_LAYER + 3 * 5, 42, VDISP_FONT_5x8, 0, ".");

	memset(str, '\0', NODEINFO_LINE_LENGTH);
	memcpy(str, settings.s.node_dup + 3, 1);
	vd_prints_xy(VDISP_NODEINFO_LAYER, XPOS_NODEINFO_LAYER + 4 * 5, 42, VDISP_FONT_5x8, (nodeinfo_pos == 21), str);

	memset(str, '\0', NODEINFO_LINE_LENGTH);
	memcpy(str, settings.s.node_dup + 4, 1);
	vd_prints_xy(VDISP_NODEINFO_LAYER, XPOS_NODEINFO_LAYER + 5 * 5, 42, VDISP_FONT_5x8, (nodeinfo_pos == 22), str);

	memset(str, '\0', NODEINFO_LINE_LENGTH);
	memcpy(str, settings.s.node_dup + 5, 1);
	vd_prints_xy(VDISP_NODEINFO_LAYER, XPOS_NODEINFO_LAYER + 6 * 5, 42, VDISP_FONT_5x8, (nodeinfo_pos == 23), str);
}
Esempio n. 8
0
static int main_app_key_event_handler (void * app_context, int key_num, int event_type)
{
	// app_context_t * a = (app_context_t *) app_context;
	
	if ((key_num == A_KEY_BUTTON_1) && (event_type == A_KEY_PRESSED))
	{
		software_ptt = 1;
		return 1;
	}
	else if ((key_num == A_KEY_BUTTON_1) && (event_type == A_KEY_RELEASED))
	{
		software_ptt = 0;
		return 1;
	}
	else if ((key_num == A_KEY_BUTTON_2) && (event_type == A_KEY_RELEASED))
	{
		if ((!key_douple_function) && (key_lock == 0))
		{
			if (ambe_get_automute() != 0) // automute is currently on
			{
				ambe_set_automute(0);
			}
			else
			{
				ambe_set_automute(1);
			}
		}
		else
		{
			key_douple_function = false;
		}
		
		return 1;
	}
	else if ((key_num == A_KEY_BUTTON_2) && (event_type == A_KEY_HOLD_2S))
	{
		key_douple_function = true;
		if (key_lock != 0)
		{
			key_lock = 0;
		}
		else
		{
			key_lock = 1;
		}
	}
	else if ((key_num == A_KEY_BUTTON_3) && (event_type == A_KEY_PRESSED))
	{
		if (r2cs_count() >= 0)
		{
			if (!r2cs_flag)
			{
				r2cs_flag = true;
				r2cs_idx = 0;

				lcd_show_menu_layer(help_layer);
				help_layer_timer = 0; // display permanent
			
				a_set_button_text_pos(main_screen, "SET", 2);
				vd_clear_rect(help_layer, 66, 58, 24, 6); // button 3
				vd_prints_xy(help_layer, 66, 58, VDISP_FONT_4x6, 0, main_screen->button_text[2]);
				
				r2cs_print(help_layer, r2cs_idx);
			}
			else
			{
				lcd_show_menu_layer(help_layer);
				help_layer_timer = 3; // approx 2 seconds

				a_set_button_text_pos(main_screen, "R>CS", 2);
				vd_clear_rect(help_layer, 66, 58, 24, 6); // button 3
				vd_prints_xy(help_layer, 66, 58, VDISP_FONT_4x6, 0, main_screen->button_text[2]);

				r2cs_flag = false;
				r2cs(help_layer, r2cs_idx);
			}
		}
		
		return 1;
	}
	else if ((key_num == A_KEY_BUTTON_3) && (event_type == A_KEY_HOLD_2S))
	{
		r2cs_flag = false;
		lcd_show_menu_layer(help_layer);
		help_layer_timer = 3; // approx 2 seconds
		r2cs(help_layer, -1);
		
		a_set_button_text_pos(main_screen, "R>CS", 2);
		vd_clear_rect(help_layer, 66, 58, 24, 6); // button 3
		vd_prints_xy(help_layer, 66, 58, VDISP_FONT_4x6, 0, main_screen->button_text[2]);
		
		return 1;
	}
	else if ((key_num == A_KEY_BUTTON_DOWN) && (event_type == A_KEY_PRESSED) && (r2cs_flag) && (r2cs_idx < r2cs_count()))
	{
		r2cs_idx++;
		r2cs_print(help_layer, r2cs_idx);
		
		return 1;
	}
	else if ((key_num == A_KEY_BUTTON_UP) && (event_type == A_KEY_PRESSED) && (r2cs_flag) && (r2cs_idx > 0))
	{
		r2cs_idx--;
		r2cs_print(help_layer, r2cs_idx);
		
		return 1;
	}
	
	return 0;
}
Esempio n. 9
0
static int dvset_app_key_event_handler (void * app_context, int key_num, int event_type)
{
	// app_context_t * a = (app_context_t *) app_context;
	
	if ((key_num == A_KEY_BUTTON_1) && (event_type == A_KEY_PRESSED))
	{
		refresh_main_menu = true;

		if (dvset_isedit())
		{
			a_set_button_text_pos(main_screen, "WRITE", 0);
			vd_clear_rect(help_layer, 0, 58, 24, 6); // button 1
			vd_prints_xy(help_layer, 0, 58, VDISP_FONT_4x6, 0, main_screen->button_text[0]);
			
			a_set_button_text_pos(main_screen, "CLEAR", 1);
			vd_clear_rect(help_layer, 34, 58, 24, 6); // button 2
			vd_prints_xy(help_layer, 34, 58, VDISP_FONT_4x6, 0, main_screen->button_text[1]);
			
			a_set_button_text_pos(main_screen, "EDIT", 2);
			vd_clear_rect(help_layer, 66, 58, 24, 6); // button 3
			vd_prints_xy(help_layer, 66, 58, VDISP_FONT_4x6, 0, main_screen->button_text[2]);
			
			a_set_button_text_pos(main_screen, "CANCEL", 3);
			vd_clear_rect(help_layer, 98, 58, 24, 6); // button 4
			vd_prints_xy(help_layer, 98, 58, VDISP_FONT_4x6, 0, main_screen->button_text[3]);
			
			dvset_store();
		}
		else
		{
			if (!dvset_isselected())
			{
				a_set_button_text_pos(main_screen, "WRITE", 0);
				vd_clear_rect(help_layer, 0, 58, 24, 6); // button 1
				vd_prints_xy(help_layer, 0, 58, VDISP_FONT_4x6, 0, main_screen->button_text[0]);
			
				a_set_button_text_pos(main_screen, "CLEAR", 1);
				vd_clear_rect(help_layer, 34, 58, 24, 6); // button 2
				vd_prints_xy(help_layer, 34, 58, VDISP_FONT_4x6, 0, main_screen->button_text[1]);
			
				a_set_button_text_pos(main_screen, "EDIT", 2);
				vd_clear_rect(help_layer, 66, 58, 24, 6); // button 3
				vd_prints_xy(help_layer, 66, 58, VDISP_FONT_4x6, 0, main_screen->button_text[2]);
			
				a_set_button_text_pos(main_screen, "CANCEL", 3);
				vd_clear_rect(help_layer, 98, 58, 24, 6); // button 4
				vd_prints_xy(help_layer, 98, 58, VDISP_FONT_4x6, 0, main_screen->button_text[3]);
			
				dvset_select(true);
			}
			else
			{
				a_set_button_text_pos(main_screen, "SELECT", 0);
				vd_clear_rect(help_layer, 0, 58, 24, 6); // button 1
				vd_prints_xy(help_layer, 0, 58, VDISP_FONT_4x6, 0, main_screen->button_text[0]);
			
				a_set_button_text_pos(main_screen, "", 1);
				vd_clear_rect(help_layer, 34, 58, 24, 6); // button 2
				vd_prints_xy(help_layer, 34, 58, VDISP_FONT_4x6, 0, main_screen->button_text[1]);
			
				a_set_button_text_pos(main_screen, "", 2);
				vd_clear_rect(help_layer, 66, 58, 24, 6); // button 3
				vd_prints_xy(help_layer, 66, 58, VDISP_FONT_4x6, 0, main_screen->button_text[2]);
			
				a_set_button_text_pos(main_screen, "MENU", 3);
				vd_clear_rect(help_layer, 98, 58, 24, 6); // button 4
				vd_prints_xy(help_layer, 98, 58, VDISP_FONT_4x6, 0, main_screen->button_text[3]);
			
				dvset_select(false);
			}
		}
			
		dvset_print();
	}
	else if ((key_num == A_KEY_BUTTON_2) && (event_type == A_KEY_PRESSED))
	{
		if (dvset_isedit())
		{
			dvset_backspace();
		}
		else
		{
			dvset_clear();
		}

		dvset_print();
	}
	else if ((key_num == A_KEY_BUTTON_3) && (event_type == A_KEY_PRESSED))
	{
		if (dvset_isedit())
		{
			dvset_cursor(0);
		}
		else
		{
			refresh_main_menu = true;

			a_set_button_text_pos(main_screen, "STORE", 0);
			vd_clear_rect(help_layer, 0, 58, 24, 6); // button 1
			vd_prints_xy(help_layer, 0, 58, VDISP_FONT_4x6, 0, main_screen->button_text[0]);
			
			a_set_button_text_pos(main_screen, "BS", 1);
			vd_clear_rect(help_layer, 34, 58, 24, 6); // button 2
			vd_prints_xy(help_layer, 34, 58, VDISP_FONT_4x6, 0, main_screen->button_text[1]);
			
			a_set_button_text_pos(main_screen, "   <", 2);
			vd_clear_rect(help_layer, 66, 58, 24, 6); // button 3
			vd_prints_xy(help_layer, 66, 58, VDISP_FONT_4x6, 0, main_screen->button_text[2]);
			
			a_set_button_text_pos(main_screen, "   >", 3);
			vd_clear_rect(help_layer, 98, 58, 24, 6); // button 4
			vd_prints_xy(help_layer, 98, 58, VDISP_FONT_4x6, 0, main_screen->button_text[3]);
			
			dvset_goedit();
		}
		
		dvset_print();
	}
	else if ((key_num == A_KEY_BUTTON_DOWN) && (event_type == A_KEY_PRESSED || event_type == A_KEY_REPEAT))
	{
		dvset_field(1);
			
		dvset_print();
		
		return 1;
	}
	else if ((key_num == A_KEY_BUTTON_UP) && (event_type == A_KEY_PRESSED || event_type == A_KEY_REPEAT))
	{
		dvset_field(0);
			
		dvset_print();
		
		return 1;
	}
	
	return 1;
}
Esempio n. 10
0
void a_dispatch_key_event( int layer_num, int key_num, int key_event )
{
	if ((key_lock) && (key_num != A_KEY_BUTTON_2)) return;
	
	if (key_num == A_KEY_BUTTON_APP_MANAGER)
	{
		if (key_event == A_KEY_PRESSED)
		{
			if (dvset_isedit())
			{
				dvset_cursor(1);
				dvset_print();
				
				return;
			}
			else if (dvset_isselected())
			{
				a_set_button_text_pos(main_screen, "SELECT", 0);
				vd_clear_rect(help_layer, 0, 58, 24, 6); // button 1
				vd_prints_xy(help_layer, 0, 58, VDISP_FONT_4x6, 0, main_screen->button_text[0]);

				a_set_button_text_pos(main_screen, "", 1);
				vd_clear_rect(help_layer, 34, 58, 24, 6); // button 2
				vd_prints_xy(help_layer, 34, 58, VDISP_FONT_4x6, 0, main_screen->button_text[1]);
				
				a_set_button_text_pos(main_screen, "", 2);
				vd_clear_rect(help_layer, 66, 58, 24, 6); // button 3
				vd_prints_xy(help_layer, 66, 58, VDISP_FONT_4x6, 0, main_screen->button_text[2]);
				
				a_set_button_text_pos(main_screen, "MENU", 3);
				vd_clear_rect(help_layer, 98, 58, 24, 6); // button 4
				vd_prints_xy(help_layer, 98, 58, VDISP_FONT_4x6, 0, main_screen->button_text[3]);

				settings_init();
				dvset_cancel();
				dvset_print();
				
				refresh_main_menu = true;
			
				return;
			}
			else if (r2cs_flag)
			{
				r2cs_flag = false;
				lcd_show_menu_layer(help_layer);
				help_layer_timer = 3; // approx 2 seconds
			
				a_set_button_text_pos(main_screen, "R>CS", 2);
				vd_clear_rect(help_layer, 66, 58, 24, 6); // button 3
				vd_prints_xy(help_layer, 66, 58, VDISP_FONT_4x6, 0, main_screen->button_text[2]);
			
				return;
			}
			
			if (refresh_main_menu)
			{
				a_set_button_text_pos(main_screen, "PTT", 0);
				vd_clear_rect(help_layer, 0, 58, 24, 6); // button 1
				vd_prints_xy(help_layer, 0, 58, VDISP_FONT_4x6, 0, main_screen->button_text[0]);

				a_set_button_text_pos(main_screen, "MUTE", 1);
				vd_clear_rect(help_layer, 34, 58, 24, 6); // button 2
				vd_prints_xy(help_layer, 34, 58, VDISP_FONT_4x6, 0, main_screen->button_text[1]);
				
				a_set_button_text_pos(main_screen, "R>CS", 2);
				vd_clear_rect(help_layer, 66, 58, 24, 6); // button 3
				vd_prints_xy(help_layer, 66, 58, VDISP_FONT_4x6, 0, main_screen->button_text[2]);
				
				a_set_button_text_pos(main_screen, "MENU", 3);
				vd_clear_rect(help_layer, 98, 58, 24, 6); // button 4
				vd_prints_xy(help_layer, 98, 58, VDISP_FONT_4x6, 0, main_screen->button_text[3]);

				refresh_main_menu = false;
			}
		
			snmp_reset_cmnty = 0;
			
			software_ptt = 0; // prevent TXing forever...
			
			app_manager_select_next();
			lcd_show_help_layer(help_layer);
			
			if ((current_app->screen_num == VDISP_REF_LAYER) ||
				(current_app->screen_num == VDISP_DVSET_LAYER) ||
				(current_app->screen_num == VDISP_MAIN_LAYER && r2csURCALL()))
			{
				help_layer_timer = 0; // show help forever..
			}
			else if (current_app->screen_num == VDISP_RMUSET_LAYER)
			{
				help_layer_timer = 0; // show help forever..

				rmuset_print();				
			}
			else
			{
				help_layer_timer = 5; // approx 2 seconds
			}			
		}
		
		if (key_event == A_KEY_HOLD_5S)
		{
			if (SETTING_CHAR(C_DISABLE_UDP_BEACON) != 0)  // toggle UDP beacon
			{
				SETTING_CHAR(C_DISABLE_UDP_BEACON) = 0; // beacon is now on
				dhcp_init(0); // switch on DHCP
				wm8510_beep(50, 1200, 100);
				
				snmp_reset_cmnty = 1;
			}
			else
			{
				SETTING_CHAR(C_DISABLE_UDP_BEACON) = 1; // // beacon is now off
				wm8510_beep(800, 300, 100);
			}
		}
		
		if (key_event == A_KEY_HOLD_10S)
		{
			if ((snmp_reset_cmnty == 2) && (SETTING_CHAR(C_DISABLE_UDP_BEACON) == 0))
			{
				settings.s.snmp_cmnty[0] = 0; // erase first byte, new string will then
				   // be generated automatically
				wm8510_beep(500, 1200, 100);
				snmp_reset_cmnty = 0;
			}
		}			
		
	}
	else
	{
		if (snmp_reset_cmnty == 1)
		{
			if ((key_num == A_KEY_BUTTON_UP) && (key_event == A_KEY_HOLD_2S))
			{
				snmp_reset_cmnty = 2;
			}
		}
		
		int res = 0;
		
		if (layer_num == VDISP_CURRENT_LAYER)
		{
			if (current_app->key_event_handler != NULL)
			{
				res = current_app->key_event_handler(current_app, key_num, key_event);
			}
		}
		else
		{
			app_context_t * tmp_app = app_list_head;
			
			while (tmp_app != NULL)
			{
				if ((tmp_app->screen_num == layer_num) && 
					(tmp_app->key_event_handler != NULL))
				{
					res = tmp_app->key_event_handler(tmp_app, key_num, key_event);
					break;
				}
				
				tmp_app = tmp_app->next;
			}
		}
		
		if (res == 0) // handler didn't use this event
		{
			if (((key_event == A_KEY_PRESSED) || (key_event == A_KEY_REPEAT)) && (!r2cs_flag))
			{
				switch (key_num)
				{
					case A_KEY_BUTTON_UP:
						set_speaker_volume(1);
						break;
						
					case A_KEY_BUTTON_DOWN:
						set_speaker_volume(0);
						break;
				}
			}				
		}
	}			
}
Esempio n. 11
0
void tx_info_on(void)
{
	if ((!tx_info)  && (!r2cs_flag) && (current_app->screen_num == VDISP_MAIN_LAYER))
	{
		char str[22];

		lcd_show_menu_layer(help_layer);
		help_layer_timer = 0; // display permanent
	
		vd_clear_rect(help_layer, 0, 12, 146, 43);	

		for (int i = 8; i < 66; i++)
		{
			vd_set_pixel(help_layer, i, 19, 0, 1, 1);
			vd_set_pixel(help_layer, i, 30, 0, 1, 1);
			vd_set_pixel(help_layer, i + 1, 31, 0, 1, 1);
		}
		for (int i = 19; i < 30; i++)
		{
			vd_set_pixel(help_layer, 8, i, 0, 1, 1);
			vd_set_pixel(help_layer, 65, i, 0, 1, 1);
			vd_set_pixel(help_layer, 66, i + 1, 0, 1, 1);
		}
	
		for (int i = 8; i < 112; i++)
		{
			vd_set_pixel(help_layer, i, 37, 0, 1, 1);
			vd_set_pixel(help_layer, i, 48, 0, 1, 1);
			vd_set_pixel(help_layer, i + 1, 49, 0, 1, 1);
		}
		for (int i = 37; i < 49; i++)
		{
			vd_set_pixel(help_layer, 8, i, 0, 1, 1);
			vd_set_pixel(help_layer, 112, i, 0, 1, 1);
			vd_set_pixel(help_layer, 113, i + 1, 0, 1, 1);
		}

		memset(str, '\0', 22);
		memcpy(str, getURCALL(), CALLSIGN_LENGTH);
	
		vd_prints_xy(help_layer, 10, 21, VDISP_FONT_5x8, 0, "ur");
		vd_prints_xy(help_layer, 20, 21, VDISP_FONT_5x8, 0, str);
	
		vd_prints_xy(help_layer, 70, 18, VDISP_FONT_4x6, 0, "R1");
		vd_prints_xy(help_layer, 70, 26, VDISP_FONT_4x6, 0, "R2");
		
		if (SETTING_CHAR(C_DV_DIRECT) != 1)
		{
			memset(str, '\0', 22);
		
			memcpy(str, settings.s.rpt1 + ((SETTING_CHAR(C_DV_USE_RPTR_SETTING) - 1)*CALLSIGN_LENGTH), CALLSIGN_LENGTH);
		
			vd_prints_xy(help_layer, 80, 18, VDISP_FONT_4x6, 0, str);
		
			memset(str, '\0', 22);
		
			memcpy(str, settings.s.rpt2 + ((SETTING_CHAR(C_DV_USE_RPTR_SETTING) - 1)*CALLSIGN_LENGTH), CALLSIGN_LENGTH);
		
			vd_prints_xy(help_layer, 80, 26, VDISP_FONT_4x6, 0, str);
		}
		else
		{
			vd_prints_xy(help_layer, 80, 18, VDISP_FONT_4x6, 0, "DIRECT  ");
			vd_prints_xy(help_layer, 80, 26, VDISP_FONT_4x6, 0, "DIRECT  ");
		}
	
		memset(str, '\0', 22);
		memcpy(str, settings.s.txmsg, TXMSG_LENGTH);
	
		vd_prints_xy(help_layer, 10, 40, VDISP_FONT_5x8, 0, str);

		tx_info = true;
	}
}