Exemple #1
0
int update_from_shmem(param_t param, union param_value_u *value)
{
	unsigned int byte_changed, bit_changed;
	unsigned int retval = 0;

	if (!handle_in_range(param) || value == NULL) {
		return retval;
	}

	update_from_shmem_current_time = hrt_absolute_time();

	if ((update_from_shmem_current_time - update_from_shmem_prev_time)
	    > 1000000) { //update every 1 second
		update_from_shmem_prev_time = update_from_shmem_current_time;
		update_index_from_shmem();
	}

	byte_changed = param / 8;
	bit_changed = 1 << param % 8;

	if (krait_changed_index[byte_changed] & bit_changed) {
		update_value_from_shmem(param, value);
		krait_changed_index[byte_changed] &= ~bit_changed;
		retval = 1;
	}

	//else {PX4_INFO("no change to param %s\n", param_name(param));}

	PX4_DEBUG("%s %d bit on krait changed index[%d]\n",
		  (retval) ? "cleared" : "unchanged", bit_changed, byte_changed);

	return retval;
}
Exemple #2
0
int update_from_shmem(param_t param, union param_value_u *value)
{
	unsigned int byte_changed, bit_changed;
	unsigned int retval = 0;

	update_from_shmem_current_time = hrt_absolute_time();

	if ((update_from_shmem_current_time - update_from_shmem_prev_time)
	    > 1000000) { //update every 1 second
		update_from_shmem_prev_time = update_from_shmem_current_time;
		update_index_from_shmem();
	}

	byte_changed = param / 8;
	bit_changed = 1 << param % 8;

	if (adsp_changed_index[byte_changed] & bit_changed) {
		update_value_from_shmem(param, value);
		adsp_changed_index[byte_changed] &= ~bit_changed; //clear the bit
		retval = 1;
	}

	//else {PX4_INFO("no change to param %s\n", param_name(param));}

	//PX4_INFO("%s %d bit on adsp index[%d]\n", (retval)?"cleared":"unchanged", bit_changed, byte_changed);

	return retval;
}