134{
135
138 {
139 return;
140 }
141
142#if CONFIG_MESHX_LOG_THREADED
143 meshx_log_msg_t msg;
144 memset(&msg, 0, sizeof(msg));
147#else
150 memset(buf, 0, sizeof(buf));
151#endif
152
153 unsigned int timestamp = 0;
155
157 pkt->level = (uint8_t)log_level;
158 pkt->module_id = (uint8_t)module_id;
159 pkt->timestamp = (uint32_t)timestamp;
160 pkt->fmt_addr = (uint32_t)fmt;
161 pkt->file_addr = (uint32_t)file;
162 pkt->line_no = (uint16_t)line_no;
163
164
165 va_list args_copy;
166 va_copy(args_copy, args);
167 for (int i = 0; i < 16; i++) {
168 pkt->args[i] = va_arg(args_copy, uint32_t);
169 }
170 va_end(args_copy);
171
172
173 const char *p = fmt;
174 int arg_idx = 0;
175 bool found_s = false;
176 while (*p) {
177 if (*p == '%' && *(p+1) != '%') {
178 p++;
179
180 while (*p && (isdigit((int)*p) || strchr("-+ #.0123456789", *p))) p++;
181 while (*p && strchr("lhjzL", *p)) p++;
182
183 if (*p == 's') {
184 found_s = true;
185 break;
186 }
187 arg_idx++;
188 if (arg_idx >= 16) break;
189 }
190 p++;
191 }
192
193 if (found_s && arg_idx < 16) {
194 uint32_t str_ptr = pkt->args[arg_idx];
195
196
197 if (str_ptr >= 0x3FC00000 && str_ptr < 0x40000000) {
198 strncpy(pkt->inline_str, (const char *)str_ptr, sizeof(pkt->inline_str) - 1);
199 pkt->inline_str[sizeof(pkt->inline_str) - 1] = '\0';
200 }
201 }
202
204
206
207#if CONFIG_MESHX_LOG_THREADED
208 if (log_threaded_init_done)
209 {
210
212 return;
213 }
214 }
215#endif
216
217
219}
static uint8_t calculate_xor_parity(const uint8_t *data, uint16_t len)
Calculates XOR parity for a buffer.
Definition meshx_log.c:78
#define MESHX_LOG_SYNC_WORD
Definition meshx_log.h:70
meshx_err_t meshx_msg_q_send(meshx_msg_q_t *msg_q_handle, void const *msg, size_t msg_len, uint32_t delay_ms)
Send a Message to a MeshX Message Queue Back.
meshx_err_t meshx_rtos_get_sys_time(unsigned int *millis)
Retrieves the current system time in milliseconds.
TLV Log Packet structure.
Definition meshx_log.h:85