Ken Van Hoeylandt 3ea02d912f
Merge develop into main (#167)
- WiFi Connect app is now hidden by default, but accessible at the bottom of the WiFi Manage app when WiFi is turned on.
- WiFi service now turns on WiFi when calling connect() and WiFi is not on.
- Removed `blocking` option for `service::loader::startApp()`. This feature was unused and complex.
- Various apps: Moved private headers into Private/ folder.
- Various apps: created start() function for easy starting.
- Added documentation to all TactilityC APIs
- Refactored various `enum` into `class enum`
- Refactor M5Stack `initBoot()` (but VBus is still 0V for some reason)
2025-01-17 19:37:42 +01:00

48 lines
1.2 KiB
C++

#ifdef ESP_TARGET
#include "app/crashdiagnostics/QrUrl.h"
#include "kernel/PanicHandler.h"
#include "Log.h"
#include <sstream>
#include <esp_cpu_utils.h>
std::string getUrlFromCrashData() {
auto crash_data = getRtcCrashData();
auto* stack_buffer = (uint32_t*) malloc(crash_data.callstackLength * 2 * sizeof(uint32_t));
for (int i = 0; i < crash_data.callstackLength; ++i) {
const CallstackFrame&frame = crash_data.callstack[i];
uint32_t pc = esp_cpu_process_stack_pc(frame.pc);
#if CRASH_DATA_INCLUDES_SP
uint32_t sp = frame.sp;
#endif
stack_buffer[i * 2] = pc;
#if CRASH_DATA_INCLUDES_SP
stack_buffer[(i * 2) + 1] = sp;
#endif
}
std::stringstream stream;
stream << "https://oops.tactility.one";
stream << "?v=" << TT_VERSION; // Version
stream << "&a=" << CONFIG_IDF_TARGET; // Architecture
stream << "&s="; // Stacktrace
for (int i = crash_data.callstackLength - 1; i >= 0; --i) {
uint32_t pc = stack_buffer[(i * 2)];
stream << std::hex << pc;
#if CRASH_DATA_INCLUDES_SP
uint32_t sp = stack_buffer[(i * 2) + 1];
stream << std::hex << sp;
#endif
}
free(stack_buffer);
return stream.str();
}
#endif