@@ -40,6 +40,7 @@ void config_default_init(Configuration* config) {
40
40
config -> bitmapPath [LIGHTMSG_MAX_BITMAPPATH_LEN + 1 ] = '\0' ;
41
41
config -> color = LIGHTMSG_DEFAULT_COLOR ; // Default color
42
42
config -> brightness = LIGHTMSG_DEFAULT_BRIGHTNESS ; // Default brightness
43
+ config -> sensitivity = LIGHTMSG_DEFAULT_SENSIBILITY ; // Default sensitivity
43
44
config -> orientation = LIGHTMSG_DEFAULT_ORIENTATION ; // Default orientation (e.g., false)
44
45
}
45
46
@@ -79,6 +80,7 @@ l401_err config_to_json(Configuration* config, char** jsontxt) {
79
80
// overrites brightness setting
80
81
cJSON_AddNumberToObject (
81
82
json , "brightness" , LightMsg_BrightnessBlinding ); // (double)config->brightness);
83
+ cJSON_AddNumberToObject (json , "sensitivity" , (double )config -> sensitivity );
82
84
cJSON_AddBoolToObject (json , "orientation" , config -> orientation );
83
85
84
86
// Convert cJSON object to string
@@ -133,11 +135,13 @@ l401_err json_to_config(char* jsontxt, Configuration* config) {
133
135
cJSON * json_bitmapPath = cJSON_GetObjectItemCaseSensitive (json , "bitmapPath" );
134
136
cJSON * json_color = cJSON_GetObjectItemCaseSensitive (json , "color" );
135
137
cJSON * json_brightness = cJSON_GetObjectItemCaseSensitive (json , "brightness" );
138
+ cJSON * json_sensitivity = cJSON_GetObjectItemCaseSensitive (json , "sensitivity" );
136
139
cJSON * json_orientation = cJSON_GetObjectItemCaseSensitive (json , "orientation" );
137
140
138
141
if (!cJSON_IsString (json_version ) || !cJSON_IsString (json_text ) ||
139
142
!cJSON_IsString (json_bitmapPath ) || !cJSON_IsNumber (json_color ) ||
140
- !cJSON_IsNumber (json_brightness ) || !cJSON_IsBool (json_orientation )) {
143
+ !cJSON_IsNumber (json_brightness ) || !cJSON_IsNumber (json_sensitivity ) ||
144
+ !cJSON_IsBool (json_orientation )) {
141
145
cJSON_Delete (json );
142
146
FURI_LOG_E (TAG , "Error: Malformed configuration" );
143
147
return L401_ERR_MALFORMED ;
@@ -153,6 +157,7 @@ l401_err json_to_config(char* jsontxt, Configuration* config) {
153
157
// config->text = strdup(json_text->valuestring);
154
158
config -> color = (uint8_t )json_color -> valuedouble ;
155
159
config -> brightness = (uint8_t )json_brightness -> valuedouble ;
160
+ config -> sensitivity = (uint8_t )json_sensitivity -> valuedouble ;
156
161
config -> orientation = cJSON_IsTrue (json_orientation ) ? true : false;
157
162
cJSON_Delete (json );
158
163
return L401_OK ;
0 commit comments