Esempio n. 1
0
static void options_parse_toplevel(GQParserData *parser_data, GMarkupParseContext *context, const gchar *element_name, const gchar **attribute_names, const gchar **attribute_values, gpointer data, GError **error)
{
	if (g_ascii_strcasecmp(element_name, "gq") == 0)
		{
		/* optional top-level node */
		options_parse_func_push(parser_data, options_parse_toplevel, NULL, NULL);
		return;
		}
	if (g_ascii_strcasecmp(element_name, "global") == 0)
		{
		load_global_params(attribute_names, attribute_values);
		options_parse_func_push(parser_data, options_parse_global, options_parse_global_end, NULL);
		return;
		}

	if (g_ascii_strcasecmp(element_name, "layout") == 0)
		{
		LayoutWindow *lw;
		lw = layout_find_by_layout_id(options_get_id(attribute_names, attribute_values));
		if (lw)
			{
			layout_update_from_config(lw, attribute_names, attribute_values);
			}
		else
			{
			lw = layout_new_from_config(attribute_names, attribute_values, parser_data->startup);
			}
		options_parse_func_push(parser_data, options_parse_layout, options_parse_layout_end, lw);
		}
	else
		{
		log_printf("unexpected in <toplevel>: <%s>\n", element_name);
		options_parse_func_push(parser_data, options_parse_leaf, NULL, NULL);
		}
}
Esempio n. 2
0
//Loads globals from flash. Checks the startupbank value in FLASH. If it's programmed, then load the parameters from that bank.
uint8_t load_startup_params(void){

	flash_firmware_version = flash_read_word(FLASH_ADDR_firmware_version) - FLASH_SYMBOL_firmwareoffset;

	if (flash_firmware_version > 0 && flash_firmware_version < 500){

		read_all_params_from_FLASH();
		load_global_params();

		if (flash_startupbank >= 0 && flash_startupbank < 6){

			if (is_bank_filled(flash_startupbank)){

				load_params_from_sram(flash_startupbank);

			} else
				flash_startupbank=0;
		}else
			flash_startupbank=0;
	} else
		flash_startupbank=0xFF;

	return(flash_startupbank);
}