Overview
The Ravas RedBox has a parameter system that can be read. The parameters are divided into different parameter pages.
Overview
The Basic Ravas RedBox has the following configured parameter-pages:
Info
Not all pageID's are available in every Ravas RedBox. For example, the WiFi/BLE page is only accessible if the system is equipped with a WiFi/BLE module.
PageID | Description |
---|---|
SYSTEM |
Information about the Ravas RedBox |
WiFi |
WiFi connection parameter settings |
BLE |
BLE parameter settings |
SCALE x |
Scale x settings |
LOCAL RedBox |
Local Ravas RedBox settings |
LOADCELL X |
Loadcell X information/settings |
Info
The pages with an 'X' in the name have multiple pages available with the same setup. For example, 'LOADCELL A' has the same setup as 'LOADCELL B' but only if the system consists of multiple loadcells.
Getting parameters
The following code example can be used to request parameter information.
Example
bool protocol_send_param_request(PageID p_id, uint32_t parameter_id)
{
Request request = {};
request.type = Request_Type_GET_PARAMETER;
request.which_payload = Request_get_parameter_tag;
request.payload.get_parameter.page_id = p_id;
request.payload.get_parameter.parameter_id = parameter_id;
return send_request(&request);
}
Setting parameters
Set boolean parameter
Example
bool protocol_send_set_param_bool(PageID p_id, uint32_t parameter_id, bool val)
{
Request request = {};
request.type = Request_Type_SET_PARAMETER;
request.which_payload = Request_set_parameter_tag;
request.payload.set_parameter.page_id = p_id;
request.payload.set_parameter.parameter_id = parameter_id;
request.payload.set_parameter.has_new_value = true;
request.payload.set_parameter.new_value.which_value = ParameterValue_Bool_tag;
request.payload.set_parameter.new_value.value.Uint32 = val;
return send_request(&request);
}
Set uint32 parameter
Example
bool protocol_send_set_param_uint32(PageID p_id, uint32_t parameter_id, uint32_t val)
{
Request request = {};
request.type = Request_Type_SET_PARAMETER;
request.which_payload = Request_set_parameter_tag;
request.payload.set_parameter.page_id = p_id;
request.payload.set_parameter.parameter_id = parameter_id;
request.payload.set_parameter.has_new_value = true;
request.payload.set_parameter.new_value.which_value = ParameterValue_Uint32_tag;
request.payload.set_parameter.new_value.value.Uint32 = val;
return send_request(&request);
}
Set float32 parameter
Example
bool protocol_send_set_param_float(PageID p_id, uint32_t parameter_id, float val)
{
Request request = {};
request.type = Request_Type_SET_PARAMETER;
request.which_payload = Request_set_parameter_tag;
request.payload.set_parameter.page_id = p_id;
request.payload.set_parameter.parameter_id = parameter_id;
request.payload.set_parameter.has_new_value = true;
request.payload.set_parameter.new_value.which_value = ParameterValue_Float32_tag;
request.payload.set_parameter.new_value.value.Float32 = val;
return send_request(&request);
}