void settings_set_home_ref(void) { ref_home.server_num = SETTING_SHORT(S_REF_SERVER_NUM); ref_home.module_char = SETTING_CHAR(C_REF_MODULE_CHAR); ref_home.type = SETTING_CHAR(C_REF_TYPE); ref_home.dcs_connect_after_boot = SETTING_CHAR(C_DCS_CONNECT_AFTER_BOOT); }
void settings_get_home_ref(void) { SETTING_SHORT(S_REF_SERVER_NUM) = ref_home.server_num; SETTING_CHAR(C_REF_MODULE_CHAR) = ref_home.module_char; SETTING_CHAR(C_REF_TYPE) = ref_home.type; SETTING_CHAR(C_DCS_CONNECT_AFTER_BOOT) = ref_home.dcs_connect_after_boot; }
static void set_phy_parameters(void) { uint8_t value; value = SETTING_SHORT(S_PHY_TXDELAY) & 0xFF; snmp_set_phy_sysparam(1, &value, 1); value = SETTING_CHAR(C_PHY_TXGAIN) & 0xFF; snmp_set_phy_sysparam(2, &value, 1); value = SETTING_CHAR(C_PHY_RXINV) & 0xFF; snmp_set_phy_sysparam(3, &value, 1); value = SETTING_CHAR(C_PHY_TXDCSHIFT) & 0xFF; snmp_set_phy_sysparam(4, &value, 1); value = SETTING_SHORT(S_PHY_MATFST) & 0xFF; snmp_set_phy_sysparam(5, &value, 1); value = SETTING_SHORT(S_PHY_LENGTHOFVW) & 0xFF; snmp_set_phy_sysparam(6, &value, 1); }
void set_phy_parameters(void) { uint8_t value; value = SETTING_SHORT(S_PHY_TXDELAY) & 0xFF; snmp_set_phy_sysparam(1, &value, 1); value = SETTING_CHAR(C_PHY_TXGAIN) & 0xFF; snmp_set_phy_sysparam(2, &value, 1); value = SETTING_CHAR(C_PHY_RXINV) & 0xFF; snmp_set_phy_sysparam(3, &value, 1); value = SETTING_CHAR(C_PHY_TXDCSHIFT) & 0xFF; snmp_set_phy_sysparam(4, &value, 1); snmp_set_phy_sysparam_raw(5, (uint8_t *) repeater_callsign, CALLSIGN_LENGTH); /* value = SETTING_SHORT(S_PHY_MATFST) & 0xFF; snmp_set_phy_sysparam(5, &value, 1); value = SETTING_SHORT(S_PHY_LENGTHOFVW) & 0xFF; snmp_set_phy_sysparam(6, &value, 1); */ }
static int ref_app_key_event_handler (void * app_context, int key_num, int key_event) { // app_context_t * a = (app_context_t *) app_context; char v; if ((key_event == A_KEY_PRESSED) || (key_event == A_KEY_REPEAT)) { switch (key_num) { case A_KEY_BUTTON_1: // connect button if (dcs_mode != 0) { ref_selected_item = REF_SELECTION_SPECIAL; dcs_on(); if (repeater_mode || hotspot_mode) ambe_set_ref_timer(1); SETTING_CHAR(C_DCS_CONNECT_AFTER_BOOT) = 1; } break; case A_KEY_BUTTON_2: // disconnect button ref_selected_item = 0; if (dcs_mode != 0) { dcs_off(); if (repeater_mode || hotspot_mode) ambe_set_ref_timer(0); SETTING_CHAR(C_DCS_CONNECT_AFTER_BOOT) = 0; } break; case A_KEY_BUTTON_3: // select button if (!dcs_is_connected()) { int num_items = REF_NUM_ITEMS; num_items -= (repeater_mode || hotspot_mode) ? 0 : 1; ref_selected_item ++; if (ref_selected_item >= num_items) { ref_selected_item = 0; } } break; case A_KEY_BUTTON_UP: if (ref_selected_item != REF_SELECTION_SPECIAL) { v = ref_items[(int) ref_selected_item]; v++; if (v > ref_item_max_val[(int) ref_selected_item]) { v = 0; } ref_items[(int) ref_selected_item] = v; } break; case A_KEY_BUTTON_DOWN: if (ref_selected_item != REF_SELECTION_SPECIAL) { v = ref_items[(int) ref_selected_item]; if (v == 0) { v = ref_item_max_val[(int) ref_selected_item]; } else { v--; } ref_items[(int) ref_selected_item] = v; } break; } set_mode_vars(); int n = ref_items[2] * 100 + ref_items[3] * 10 + ref_items[4]; dcs_select_reflector( n, ref_items[5] + 0x41, ref_items[1]); SETTING_CHAR(C_REF_TYPE) = ref_items[1]; SETTING_SHORT(S_REF_SERVER_NUM) = n; SETTING_CHAR(C_REF_MODULE_CHAR) = ref_items[5] + 0x41; SETTING_CHAR(C_DCS_MODE) = ref_items[0]; SETTING_CHAR(C_REF_TIMER) = ref_items[6]; //settings_set_home_ref(); ref_print_status(); } return 1; }
void a_app_manager_init(void) { app_context_t * a; a = a_new_app( "DSTAR", VDISP_MAIN_LAYER); a_set_button_text(a, "PTT", "MUTE", "R>CS", "MENU"); a_set_key_event_handler(a, main_app_key_event_handler); main_screen = a; a = a_new_app( "RMU SET", VDISP_RMUSET_LAYER); a_set_button_text(a, "", "", "SELECT", "MENU"); a_set_key_event_handler(a, rmuset_app_key_event_handler); a = a_new_app( "DV SET", VDISP_DVSET_LAYER); a_set_button_text(a, "SELECT", "", "", "MENU"); a_set_key_event_handler(a, dvset_app_key_event_handler); a = a_new_app( "GPS", VDISP_GPS_LAYER); a_set_button_text(a, "", "", "", "MENU"); a = a_new_app( "MODE SET", VDISP_REF_LAYER); a_set_button_text(a, "CONNECT", "DISC", "SELECT", "MENU"); a_set_key_event_handler(a, ref_app_key_event_handler); a = a_new_app( "AUDIO", VDISP_AUDIO_LAYER); a_set_button_text(a, "", "", "", "MENU"); // a_set_key_event_handler(a, debug_app_key_event_handler); a = a_new_app( "DEBUG", VDISP_DEBUG_LAYER); a_set_button_text(a, "", "REBOOT", "", "MENU"); a_set_key_event_handler(a, debug_app_key_event_handler); a = a_new_app( "NODE INFO", VDISP_NODEINFO_LAYER); a_set_button_text(a, "GPS", "", "", "MENU"); // a_set_key_event_handler(a, debug_app_key_event_handler); help_layer = vd_new_screen(); if ((SETTING_SHORT(S_REF_SERVER_NUM) > 0) && (SETTING_SHORT(S_REF_SERVER_NUM) < 1000)) { int n = SETTING_SHORT(S_REF_SERVER_NUM); ref_items[4] = n % 10; n /= 10; ref_items[3] = n % 10; n /= 10; ref_items[2] = n % 10; } if ((SETTING_CHAR(C_REF_MODULE_CHAR) >= 'A') && (SETTING_CHAR(C_REF_MODULE_CHAR) <= 'Z')) { ref_items[5] = SETTING_CHAR(C_REF_MODULE_CHAR) - 0x41; } if ((SETTING_CHAR(C_REF_TIMER) >= 0) && (SETTING_CHAR(C_REF_TIMER) <= 7)) { ref_items[6] = SETTING_CHAR(C_REF_TIMER); } if ((SETTING_CHAR(C_DCS_MODE) >= 0) && (SETTING_CHAR(C_DCS_MODE) <= 5)) { ref_items[0] = SETTING_CHAR(C_DCS_MODE); } if ((SETTING_CHAR(C_REF_TYPE) >= 0) && (SETTING_CHAR(C_REF_TYPE) <= 2)) { ref_items[1] = SETTING_CHAR(C_REF_TYPE); } set_mode_vars(); int n = ref_items[2] * 100 + ref_items[3] * 10 + ref_items[4]; dcs_select_reflector( n, ref_items[5] + 0x41, ref_items[1]); if ((dcs_mode != 0) && (SETTING_CHAR(C_DCS_CONNECT_AFTER_BOOT) == 1)) { ref_selected_item = REF_SELECTION_SPECIAL; dcs_on(); } settings_set_home_ref(); // TODO error handling // vd_clear_rect(help_layer, 0, 0, 128, 64); int i; for (i=0; i < 128; i++) { vd_set_pixel(help_layer, i, 56, 0, 1, 1); } #define SIDEBOX_WIDTH 41 // #define SIDEBOX_HEIGHT 12 #define BOX1_YPOS 10 #define BOX2_YPOS 34 for (i=0; i < 7; i++) { vd_set_pixel(help_layer, 32, 57+i, 0, 1, 1); vd_set_pixel(help_layer, 64, 57+i, 0, 1, 1); vd_set_pixel(help_layer, 96, 57+i, 0, 1, 1); vd_set_pixel(help_layer, SIDEBOX_WIDTH - 1, i, 0, 1, 1); } for (i=0; i < SIDEBOX_WIDTH; i++) { vd_set_pixel(help_layer, i, 7, 0, 1, 1); } /* for (i=0; i <= SIDEBOX_HEIGHT; i++) { vd_set_pixel(help_layer, 127-SIDEBOX_WIDTH, BOX1_YPOS+i, 0, 1, 1); vd_set_pixel(help_layer, 127-SIDEBOX_WIDTH, BOX2_YPOS+i, 0, 1, 1); } */ // vd_prints_xy(help_layer, 4, 58, VDISP_FONT_4x6, 0,"TEST"); vd_prints_xy(VDISP_REF_LAYER, 0, 12, VDISP_FONT_6x8, 0, "Mode:"); vd_printc_xy(VDISP_REF_LAYER, 120, 13, VDISP_FONT_8x12, 0, 0x1e); // arrow up vd_printc_xy(VDISP_REF_LAYER, 120, 39, VDISP_FONT_8x12, 0, 0x1f); // arrow up vd_printc_xy(VDISP_DVSET_LAYER, 120, 13, VDISP_FONT_8x12, 0, 0x1e); // arrow up vd_printc_xy(VDISP_DVSET_LAYER, 120, 39, VDISP_FONT_8x12, 0, 0x1f); // arrow up 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 set_help_text(); }