diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/CMakeLists.txt | 223 | ||||
-rw-r--r-- | src/components/rle/RleDecoder.cpp | 39 | ||||
-rw-r--r-- | src/components/rle/RleDecoder.h | 33 | ||||
-rw-r--r-- | src/displayapp/DisplayApp.cpp | 3 | ||||
-rw-r--r-- | src/displayapp/DisplayApp.h | 6 | ||||
-rw-r--r-- | src/displayapp/DisplayAppRecovery.cpp | 110 | ||||
-rw-r--r-- | src/displayapp/DisplayAppRecovery.h | 71 | ||||
-rw-r--r-- | src/displayapp/DummyLittleVgl.h | 30 | ||||
-rw-r--r-- | src/displayapp/Messages.h | 11 | ||||
-rw-r--r-- | src/displayapp/icons/infinitime/infinitime-nb.c | 127 | ||||
-rw-r--r-- | src/displayapp/icons/infinitime/infinitime-nb.png | bin | 0 -> 3397 bytes | |||
m--------- | src/libs/lvgl | 0 | ||||
-rw-r--r-- | src/main.cpp | 16 | ||||
-rw-r--r-- | src/recoveryLoader.cpp (renamed from src/graphics.cpp) | 97 | ||||
-rw-r--r-- | src/systemtask/SystemTask.cpp | 20 | ||||
-rw-r--r-- | src/systemtask/SystemTask.h | 8 |
16 files changed, 725 insertions, 69 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 2cf570be..47b34335 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -548,7 +548,58 @@ list(APPEND SOURCE_FILES components/heartrate/HeartRateController.cpp ) -list(APPEND GRAPHICS_SOURCE_FILES +list(APPEND RECOVERY_SOURCE_FILES + BootloaderVersion.cpp + logging/NrfLogger.cpp + displayapp/DisplayAppRecovery.cpp + + main.cpp + drivers/St7789.cpp + drivers/SpiNorFlash.cpp + drivers/SpiMaster.cpp + drivers/Spi.cpp + drivers/Watchdog.cpp + drivers/DebugPins.cpp + drivers/InternalFlash.cpp + drivers/Hrs3300.cpp + components/battery/BatteryController.cpp + components/ble/BleController.cpp + components/ble/NotificationManager.cpp + components/datetime/DateTimeController.cpp + components/brightness/BrightnessController.cpp + components/ble/NimbleController.cpp + components/ble/DeviceInformationService.cpp + components/ble/CurrentTimeClient.cpp + components/ble/AlertNotificationClient.cpp + components/ble/DfuService.cpp + components/ble/CurrentTimeService.cpp + components/ble/AlertNotificationService.cpp + components/ble/MusicService.cpp + components/ble/BatteryInformationService.cpp + components/ble/ImmediateAlertService.cpp + components/ble/ServiceDiscovery.cpp + components/ble/NavigationService.cpp + components/ble/HeartRateService.cpp + components/firmwarevalidator/FirmwareValidator.cpp + drivers/Cst816s.cpp + FreeRTOS/port.c + FreeRTOS/port_cmsis_systick.c + FreeRTOS/port_cmsis.c + + systemtask/SystemTask.cpp + drivers/TwiMaster.cpp + components/gfx/Gfx.cpp + displayapp/icons/infinitime/infinitime-nb.c + components/rle/RleDecoder.cpp + components/heartrate/HeartRateController.cpp + heartratetask/HeartRateTask.cpp + components/heartrate/Ppg.cpp + components/heartrate/Biquad.cpp + components/heartrate/Ptagc.cpp + components/motor/MotorController.cpp + ) + +list(APPEND RECOVERYLOADER_SOURCE_FILES # FreeRTOS FreeRTOS/port.c FreeRTOS/port_cmsis_systick.c @@ -559,18 +610,23 @@ list(APPEND GRAPHICS_SOURCE_FILES drivers/Spi.cpp logging/NrfLogger.cpp + components/rle/RleDecoder.cpp + components/gfx/Gfx.cpp drivers/St7789.cpp components/brightness/BrightnessController.cpp - graphics.cpp + displayapp/icons/infinitime/infinitime-nb.c + recoveryLoader.cpp ) + set(INCLUDE_FILES BootloaderVersion.h logging/Logger.h logging/NrfLogger.h displayapp/DisplayApp.h + displayapp/Messages.h displayapp/TouchEvents.h displayapp/screens/Screen.h displayapp/screens/Clock.h @@ -820,8 +876,8 @@ add_custom_command(TARGET ${EXECUTABLE_NAME} # Build binary intended to be used by bootloader set(EXECUTABLE_MCUBOOT_NAME "pinetime-mcuboot-app") set(EXECUTABLE_MCUBOOT_FILE_NAME ${EXECUTABLE_MCUBOOT_NAME}-${pinetime_VERSION_MAJOR}.${pinetime_VERSION_MINOR}.${pinetime_VERSION_PATCH}) -set(IMAGE_MCUBOOT_FILE_NAME image-${pinetime_VERSION_MAJOR}.${pinetime_VERSION_MINOR}.${pinetime_VERSION_PATCH}.bin) -set(DFU_FILE_NAME dfu-${pinetime_VERSION_MAJOR}.${pinetime_VERSION_MINOR}.${pinetime_VERSION_PATCH}.zip) +set(IMAGE_MCUBOOT_FILE_NAME ${EXECUTABLE_MCUBOOT_NAME}-image-${pinetime_VERSION_MAJOR}.${pinetime_VERSION_MINOR}.${pinetime_VERSION_PATCH}.bin) +set(DFU_MCUBOOT_FILE_NAME ${EXECUTABLE_MCUBOOT_NAME}-dfu-${pinetime_VERSION_MAJOR}.${pinetime_VERSION_MINOR}.${pinetime_VERSION_PATCH}.zip) set(NRF5_LINKER_SCRIPT_MCUBOOT "${CMAKE_SOURCE_DIR}/gcc_nrf52-mcuboot.ld") add_executable(${EXECUTABLE_MCUBOOT_NAME} ${SOURCE_FILES}) target_link_libraries(${EXECUTABLE_MCUBOOT_NAME} nimble nrf-sdk lvgl) @@ -846,16 +902,26 @@ add_custom_command(TARGET ${EXECUTABLE_MCUBOOT_NAME} COMMAND ${CMAKE_SIZE_UTIL} ${EXECUTABLE_MCUBOOT_FILE_NAME}.out COMMAND ${CMAKE_OBJCOPY} -O binary ${EXECUTABLE_MCUBOOT_FILE_NAME}.out "${EXECUTABLE_MCUBOOT_FILE_NAME}.bin" COMMAND ${CMAKE_OBJCOPY} -O ihex ${EXECUTABLE_MCUBOOT_FILE_NAME}.out "${EXECUTABLE_MCUBOOT_FILE_NAME}.hex" + COMMAND ${CMAKE_SOURCE_DIR}/tools/mcuboot/imgtool.py create --align 4 --version 1.0.0 --header-size 32 --slot-size 475136 --pad-header ${EXECUTABLE_MCUBOOT_FILE_NAME}.bin ${IMAGE_MCUBOOT_FILE_NAME} COMMENT "post build steps for ${EXECUTABLE_MCUBOOT_FILE_NAME}" ) -# Build binary that writes the graphic assets for the bootloader -set(EXECUTABLE_GRAPHICS_NAME "pinetime-graphics") -set(EXECUTABLE_GRAPHICS_FILE_NAME ${EXECUTABLE_GRAPHICS_NAME}-${pinetime_VERSION_MAJOR}.${pinetime_VERSION_MINOR}.${pinetime_VERSION_PATCH}) -add_executable(${EXECUTABLE_GRAPHICS_NAME} ${GRAPHICS_SOURCE_FILES}) -target_link_libraries(${EXECUTABLE_GRAPHICS_NAME} nrf-sdk) -set_target_properties(${EXECUTABLE_GRAPHICS_NAME} PROPERTIES OUTPUT_NAME ${EXECUTABLE_GRAPHICS_FILE_NAME}) -target_compile_options(${EXECUTABLE_GRAPHICS_NAME} PUBLIC +if(BUILD_DFU) + add_custom_command(TARGET ${EXECUTABLE_MCUBOOT_NAME} + POST_BUILD + COMMAND adafruit-nrfutil dfu genpkg --dev-type 0x0052 --application ${IMAGE_MCUBOOT_FILE_NAME} ${DFU_MCUBOOT_FILE_NAME} + COMMENT "post build (DFU) steps for ${EXECUTABLE_MCUBOOT_FILE_NAME}" + ) +endif() + +# InfiniTime recovery firmware (autonomous) +set(EXECUTABLE_RECOVERY_NAME "pinetime-recovery") +set(EXECUTABLE_RECOVERY_FILE_NAME ${EXECUTABLE_RECOVERY_NAME}-${pinetime_VERSION_MAJOR}.${pinetime_VERSION_MINOR}.${pinetime_VERSION_PATCH}) +add_executable(${EXECUTABLE_RECOVERY_NAME} ${RECOVERY_SOURCE_FILES}) +target_link_libraries(${EXECUTABLE_RECOVERY_NAME} nimble nrf-sdk) +set_target_properties(${EXECUTABLE_RECOVERY_NAME} PROPERTIES OUTPUT_NAME ${EXECUTABLE_RECOVERY_FILE_NAME}) +target_compile_definitions(${EXECUTABLE_RECOVERY_NAME} PUBLIC "PINETIME_IS_RECOVERY") +target_compile_options(${EXECUTABLE_RECOVERY_NAME} PUBLIC $<$<AND:$<COMPILE_LANGUAGE:C>,$<CONFIG:DEBUG>>: ${COMMON_FLAGS} -O0 -g3> $<$<AND:$<COMPILE_LANGUAGE:C>,$<CONFIG:RELEASE>>: ${COMMON_FLAGS} -O3> $<$<AND:$<COMPILE_LANGUAGE:CXX>,$<CONFIG:DEBUG>>: ${COMMON_FLAGS} -O0 -g3> @@ -863,21 +929,142 @@ target_compile_options(${EXECUTABLE_GRAPHICS_NAME} PUBLIC $<$<COMPILE_LANGUAGE:ASM>: -MP -MD -x assembler-with-cpp> ) -set_target_properties(${EXECUTABLE_GRAPHICS_NAME} PROPERTIES +set_target_properties(${EXECUTABLE_RECOVERY_NAME} PROPERTIES SUFFIX ".out" - LINK_FLAGS "-mthumb -mabi=aapcs -L ${NRF5_SDK_PATH}/modules/nrfx/mdk -T${NRF5_LINKER_SCRIPT} -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -Wl,--gc-sections --specs=nano.specs -lc -lnosys -lm -Wl,-Map=${EXECUTABLE_GRAPHICS_FILE_NAME}.map" + LINK_FLAGS "-mthumb -mabi=aapcs -L ${NRF5_SDK_PATH}/modules/nrfx/mdk -T${NRF5_LINKER_SCRIPT} -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -Wl,--gc-sections --specs=nano.specs -lc -lnosys -lm -Wl,-Map=${EXECUTABLE_RECOVERY_FILE_NAME}.map" CXX_STANDARD 11 C_STANDARD 99 ) -add_custom_command(TARGET ${EXECUTABLE_GRAPHICS_NAME} +add_custom_command(TARGET ${EXECUTABLE_RECOVERY_NAME} POST_BUILD - COMMAND ${CMAKE_SIZE_UTIL} ${EXECUTABLE_GRAPHICS_FILE_NAME}.out - COMMAND ${CMAKE_OBJCOPY} -O binary ${EXECUTABLE_GRAPHICS_FILE_NAME}.out "${EXECUTABLE_GRAPHICS_FILE_NAME}.bin" - COMMAND ${CMAKE_OBJCOPY} -O ihex ${EXECUTABLE_GRAPHICS_FILE_NAME}.out "${EXECUTABLE_GRAPHICS_FILE_NAME}.hex" - COMMENT "post build steps for ${EXECUTABLE_GRAPHICS_FILE_NAME}" + COMMAND ${CMAKE_SIZE_UTIL} ${EXECUTABLE_RECOVERY_FILE_NAME}.out + COMMAND ${CMAKE_OBJCOPY} -O binary ${EXECUTABLE_RECOVERY_FILE_NAME}.out "${EXECUTABLE_RECOVERY_FILE_NAME}.bin" + COMMAND ${CMAKE_OBJCOPY} -O ihex ${EXECUTABLE_RECOVERY_FILE_NAME}.out "${EXECUTABLE_RECOVERY_FILE_NAME}.hex" + COMMENT "post build steps for ${EXECUTABLE_RECOVERY_FILE_NAME}" ) +# InfiniTime recovery firmware (mcuboot) +set(EXECUTABLE_RECOVERY_MCUBOOT_NAME "pinetime-mcuboot-recovery") +set(EXECUTABLE_RECOVERY_MCUBOOT_FILE_NAME ${EXECUTABLE_RECOVERY_MCUBOOT_NAME}-${pinetime_VERSION_MAJOR}.${pinetime_VERSION_MINOR}.${pinetime_VERSION_PATCH}) +set(IMAGE_RECOVERY_MCUBOOT_FILE_NAME ${EXECUTABLE_RECOVERY_MCUBOOT_NAME}-image-${pinetime_VERSION_MAJOR}.${pinetime_VERSION_MINOR}.${pinetime_VERSION_PATCH}.bin) +set(DFU_RECOVERY_MCUBOOT_FILE_NAME ${EXECUTABLE_RECOVERY_MCUBOOT_NAME}-dfu-${pinetime_VERSION_MAJOR}.${pinetime_VERSION_MINOR}.${pinetime_VERSION_PATCH}.zip) +add_executable(${EXECUTABLE_RECOVERY_MCUBOOT_NAME} ${RECOVERY_SOURCE_FILES}) +target_link_libraries(${EXECUTABLE_RECOVERY_MCUBOOT_NAME} nimble nrf-sdk) +set_target_properties(${EXECUTABLE_RECOVERY_MCUBOOT_NAME} PROPERTIES OUTPUT_NAME ${EXECUTABLE_RECOVERY_MCUBOOT_FILE_NAME}) +target_compile_definitions(${EXECUTABLE_RECOVERY_MCUBOOT_NAME} PUBLIC "PINETIME_IS_RECOVERY") +target_compile_options(${EXECUTABLE_RECOVERY_MCUBOOT_NAME} PUBLIC + $<$<AND:$<COMPILE_LANGUAGE:C>,$<CONFIG:DEBUG>>: ${COMMON_FLAGS} -O0 -g3> + $<$<AND:$<COMPILE_LANGUAGE:C>,$<CONFIG:RELEASE>>: ${COMMON_FLAGS} -O3> + $<$<AND:$<COMPILE_LANGUAGE:CXX>,$<CONFIG:DEBUG>>: ${COMMON_FLAGS} -O0 -g3> + $<$<AND:$<COMPILE_LANGUAGE:CXX>,$<CONFIG:RELEASE>>: ${COMMON_FLAGS} -O3> + $<$<COMPILE_LANGUAGE:ASM>: -MP -MD -x assembler-with-cpp> + ) + +set_target_properties(${EXECUTABLE_RECOVERY_MCUBOOT_NAME} PROPERTIES + SUFFIX ".out" + LINK_FLAGS "-mthumb -mabi=aapcs -L ${NRF5_SDK_PATH}/modules/nrfx/mdk -T${NRF5_LINKER_SCRIPT_MCUBOOT} -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -Wl,--gc-sections --specs=nano.specs -lc -lnosys -lm -Wl,-Map=${EXECUTABLE_RECOVERY_MCUBOOT_FILE_NAME}.map" + CXX_STANDARD 11 + C_STANDARD 99 + ) + +add_custom_command(TARGET ${EXECUTABLE_RECOVERY_MCUBOOT_NAME} + POST_BUILD + COMMAND ${CMAKE_SIZE_UTIL} ${EXECUTABLE_RECOVERY_MCUBOOT_FILE_NAME}.out + COMMAND ${CMAKE_OBJCOPY} -O binary ${EXECUTABLE_RECOVERY_MCUBOOT_FILE_NAME}.out "${EXECUTABLE_RECOVERY_MCUBOOT_FILE_NAME}.bin" + COMMAND ${CMAKE_OBJCOPY} -O ihex ${EXECUTABLE_RECOVERY_MCUBOOT_FILE_NAME}.out "${EXECUTABLE_RECOVERYY_MCUBOOT_FILE_NAME}.hex" + COMMAND ${CMAKE_SOURCE_DIR}/tools/mcuboot/imgtool.py create --align 4 --version 1.0.0 --header-size 32 --slot-size 475136 --pad-header ${EXECUTABLE_RECOVERY_MCUBOOT_FILE_NAME}.bin ${IMAGE_RECOVERY_MCUBOOT_FILE_NAME} + COMMAND python ${CMAKE_SOURCE_DIR}/tools/bin2c.py ${IMAGE_RECOVERY_MCUBOOT_FILE_NAME} recoveryImage > recoveryImage.h + COMMENT "post build steps for ${EXECUTABLE_RECOVERY_MCUBOOT_FILE_NAME}" + ) + +if(BUILD_DFU) + add_custom_command(TARGET ${EXECUTABLE_RECOVERY_MCUBOOT_NAME} + POST_BUILD + COMMAND adafruit-nrfutil dfu genpkg --dev-type 0x0052 --application ${IMAGE_RECOVERY_MCUBOOT_FILE_NAME} ${DFU_RECOVERY_MCUBOOT_FILE_NAME} + COMMENT "post build (DFU) steps for ${EXECUTABLE_RECOVERY_MCUBOOT_FILE_NAME}" + ) +endif() + +# Build binary that writes the recovery image into the SPI flash memory +set(EXECUTABLE_RECOVERYLOADER_NAME "pinetime-recovery-loader") +set(EXECUTABLE_RECOVERYLOADER_FILE_NAME ${EXECUTABLE_RECOVERYLOADER_NAME}-${pinetime_VERSION_MAJOR}.${pinetime_VERSION_MINOR}.${pinetime_VERSION_PATCH}) +add_executable(${EXECUTABLE_RECOVERYLOADER_NAME} ${RECOVERYLOADER_SOURCE_FILES}) +target_link_libraries(${EXECUTABLE_RECOVERYLOADER_NAME} nrf-sdk) +set_target_properties(${EXECUTABLE_RECOVERYLOADER_NAME} PROPERTIES OUTPUT_NAME ${EXECUTABLE_RECOVERYLOADER_FILE_NAME}) +target_compile_options(${EXECUTABLE_RECOVERYLOADER_NAME} PUBLIC + $<$<AND:$<COMPILE_LANGUAGE:C>,$<CONFIG:DEBUG>>: ${COMMON_FLAGS} -O0 -g3> + $<$<AND:$<COMPILE_LANGUAGE:C>,$<CONFIG:RELEASE>>: ${COMMON_FLAGS} -O3> + $<$<AND:$<COMPILE_LANGUAGE:CXX>,$<CONFIG:DEBUG>>: ${COMMON_FLAGS} -O0 -g3> + $<$<AND:$<COMPILE_LANGUAGE:CXX>,$<CONFIG:RELEASE>>: ${COMMON_FLAGS} -O3> + $<$<COMPILE_LANGUAGE:ASM>: -MP -MD -x assembler-with-cpp> + ) +target_include_directories(${EXECUTABLE_RECOVERYLOADER_NAME} PUBLIC + $<BUILD_INTERFACE:${CMAKE_BINARY_DIR}/src> + ) +add_dependencies(${EXECUTABLE_RECOVERYLOADER_NAME} ${EXECUTABLE_RECOVERY_MCUBOOT_NAME}) + +set_target_properties(${EXECUTABLE_RECOVERYLOADER_NAME} PROPERTIES + SUFFIX ".out" + LINK_FLAGS "-mthumb -mabi=aapcs -L ${NRF5_SDK_PATH}/modules/nrfx/mdk -T${NRF5_LINKER_SCRIPT} -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -Wl,--gc-sections --specs=nano.specs -lc -lnosys -lm -Wl,-Map=${EXECUTABLE_RECOVERYLOADER_FILE_NAME}.map" + CXX_STANDARD 11 + C_STANDARD 99 + ) + +add_custom_command(TARGET ${EXECUTABLE_RECOVERYLOADER_NAME} + POST_BUILD + COMMAND ${CMAKE_SIZE_UTIL} ${EXECUTABLE_RECOVERYLOADER_FILE_NAME}.out + COMMAND ${CMAKE_OBJCOPY} -O binary ${EXECUTABLE_RECOVERYLOADER_FILE_NAME}.out "${EXECUTABLE_RECOVERYLOADER_FILE_NAME}.bin" + COMMAND ${CMAKE_OBJCOPY} -O ihex ${EXECUTABLE_RECOVERYLOADER_FILE_NAME}.out "${EXECUTABLE_RECOVERYLOADER_FILE_NAME}.hex" + COMMENT "post build steps for ${EXECUTABLE_RECOVERYLOADER_FILE_NAME}" + ) + +# Build binary that writes the recovery image (MCUBoot version) +set(EXECUTABLE_MCUBOOT_RECOVERYLOADER_NAME "pinetime-mcuboot-recovery-loader") +set(EXECUTABLE_MCUBOOT_RECOVERYLOADER_FILE_NAME ${EXECUTABLE_MCUBOOT_RECOVERYLOADER_NAME}-${pinetime_VERSION_MAJOR}.${pinetime_VERSION_MINOR}.${pinetime_VERSION_PATCH}) +set(IMAGE_MCUBOOT_RECOVERYLOADER_FILE_NAME ${EXECUTABLE_MCUBOOT_RECOVERYLOADER_NAME}-image-${pinetime_VERSION_MAJOR}.${pinetime_VERSION_MINOR}.${pinetime_VERSION_PATCH}.bin) +set(DFU_MCUBOOT_RECOVERYLOADER_FILE_NAME ${EXECUTABLE_MCUBOOT_RECOVERYLOADER_NAME}-dfu-${pinetime_VERSION_MAJOR}.${pinetime_VERSION_MINOR}.${pinetime_VERSION_PATCH}.zip) +add_executable(${EXECUTABLE_MCUBOOT_RECOVERYLOADER_NAME} ${RECOVERYLOADER_SOURCE_FILES}) +target_link_libraries(${EXECUTABLE_MCUBOOT_RECOVERYLOADER_NAME} nrf-sdk) +set_target_properties(${EXECUTABLE_MCUBOOT_RECOVERYLOADER_NAME} PROPERTIES OUTPUT_NAME ${EXECUTABLE_MCUBOOT_RECOVERYLOADER_FILE_NAME}) +target_compile_options(${EXECUTABLE_MCUBOOT_RECOVERYLOADER_NAME} PUBLIC + $<$<AND:$<COMPILE_LANGUAGE:C>,$<CONFIG:DEBUG>>: ${COMMON_FLAGS} -O0 -g3> + $<$<AND:$<COMPILE_LANGUAGE:C>,$<CONFIG:RELEASE>>: ${COMMON_FLAGS} -O3> + $<$<AND:$<COMPILE_LANGUAGE:CXX>,$<CONFIG:DEBUG>>: ${COMMON_FLAGS} -O0 -g3> + $<$<AND:$<COMPILE_LANGUAGE:CXX>,$<CONFIG:RELEASE>>: ${COMMON_FLAGS} -O3> + $<$<COMPILE_LANGUAGE:ASM>: -MP -MD -x assembler-with-cpp> + ) +target_include_directories(${EXECUTABLE_MCUBOOT_RECOVERYLOADER_NAME} PUBLIC + $<BUILD_INTERFACE:${CMAKE_BINARY_DIR}/src> + ) +add_dependencies(${EXECUTABLE_MCUBOOT_RECOVERYLOADER_NAME} ${EXECUTABLE_RECOVERY_MCUBOOT_NAME}) + +set_target_properties(${EXECUTABLE_MCUBOOT_RECOVERYLOADER_NAME} PROPERTIES + SUFFIX ".out" + LINK_FLAGS "-mthumb -mabi=aapcs -std=gnu++98 -std=c99 -L ${NRF5_SDK_PATH}/modules/nrfx/mdk -T${NRF5_LINKER_SCRIPT_MCUBOOT} -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -Wl,--gc-sections --specs=nano.specs -lc -lnosys -lm -Wl,-Map=${EXECUTABLE_MCUBOOT_RECOVERYLOADER_FILE_NAME}.map" + CXX_STANDARD 11 + C_STANDARD 99 + ) + +add_custom_command(TARGET ${EXECUTABLE_MCUBOOT_RECOVERYLOADER_NAME} + POST_BUILD + COMMAND ${CMAKE_SIZE_UTIL} ${EXECUTABLE_MCUBOOT_RECOVERYLOADER_FILE_NAME}.out + COMMAND ${CMAKE_OBJCOPY} -O binary ${EXECUTABLE_MCUBOOT_RECOVERYLOADER_FILE_NAME}.out "${EXECUTABLE_MCUBOOT_RECOVERYLOADER_FILE_NAME}.bin" + COMMAND ${CMAKE_OBJCOPY} -O ihex ${EXECUTABLE_MCUBOOT_RECOVERYLOADER_FILE_NAME}.out "${EXECUTABLE_MCUBOOT_RECOVERYLOADER_FILE_NAME}.hex" + COMMAND ${CMAKE_SOURCE_DIR}/tools/mcuboot/imgtool.py create --align 4 --version 1.0.0 --header-size 32 --slot-size 475136 --pad-header ${EXECUTABLE_MCUBOOT_RECOVERYLOADER_FILE_NAME}.bin ${IMAGE_MCUBOOT_RECOVERYLOADER_FILE_NAME} + COMMAND python ${CMAKE_SOURCE_DIR}/tools/bin2c.py ${IMAGE_MCUBOOT_RECOVERYLOADER_FILE_NAME} recoveryLoaderImage > recoveryLoaderImage.h + COMMENT "post build steps for ${EXECUTABLE_MCUBOOT_RECOVERYLOADER_FILE_NAME}" + ) + +if(BUILD_DFU) + add_custom_command(TARGET ${EXECUTABLE_MCUBOOT_RECOVERYLOADER_NAME} + POST_BUILD + COMMAND adafruit-nrfutil dfu genpkg --dev-type 0x0052 --application ${IMAGE_MCUBOOT_RECOVERYLOADER_FILE_NAME} ${DFU_MCUBOOT_RECOVERYLOADER_FILE_NAME} + COMMENT "post build (DFU) steps for ${EXECUTABLE_MCUBOOT_RECOVERYLOADER_FILE_NAME}" + ) +endif() + + # FLASH if (USE_JLINK) add_custom_target(FLASH_ERASE diff --git a/src/components/rle/RleDecoder.cpp b/src/components/rle/RleDecoder.cpp new file mode 100644 index 00000000..19a90fda --- /dev/null +++ b/src/components/rle/RleDecoder.cpp @@ -0,0 +1,39 @@ +#include "RleDecoder.h" + +using namespace Pinetime::Tools; + +RleDecoder::RleDecoder(const uint8_t *buffer, size_t size) : buffer{buffer}, size{size} { + +} + +RleDecoder::RleDecoder(const uint8_t *buffer, size_t size, uint16_t foregroundColor, uint16_t backgroundColor) : RleDecoder{buffer, size} { + this->foregroundColor = foregroundColor; + this->backgroundColor = backgroundColor; +} + + +void RleDecoder::DecodeNext(uint8_t *output, size_t maxBytes) { + for (;encodedBufferIndex<size; encodedBufferIndex++) { + uint8_t rl = buffer[encodedBufferIndex] - processedCount; + while (rl) { + output[bp] = color >> 8; + output[bp + 1] = color & 0xff; + bp += 2; + rl -= 1; + processedCount++; + + if (bp >= maxBytes) { + bp = 0; + y += 1; + return; + } + } + processedCount = 0; + + if (color == backgroundColor) + color = foregroundColor; + else + color = backgroundColor; + } +} + diff --git a/src/components/rle/RleDecoder.h b/src/components/rle/RleDecoder.h new file mode 100644 index 00000000..0f607fb8 --- /dev/null +++ b/src/components/rle/RleDecoder.h @@ -0,0 +1,33 @@ +#pragma once + +#include <cstdint> +#include <cstddef> + +namespace Pinetime { + namespace Tools { + /* 1-bit RLE decoder. Provide the encoded buffer to the constructor and then call DecodeNext() by + * specifying the output (decoded) buffer and the maximum number of bytes this buffer can handle. + * + * Code from https://github.com/daniel-thompson/wasp-bootloader by Daniel Thompson released under the MIT license. + */ + class RleDecoder { + public: + RleDecoder(const uint8_t* buffer, size_t size); + RleDecoder(const uint8_t* buffer, size_t size, uint16_t foregroundColor, uint16_t backgroundColor); + + void DecodeNext(uint8_t* output, size_t maxBytes); + + private: + const uint8_t* buffer; + size_t size; + + int encodedBufferIndex = 0; + int y = 0; + uint16_t bp = 0; + uint16_t foregroundColor = 0xffff; + uint16_t backgroundColor = 0; + uint16_t color = backgroundColor; + int processedCount = 0; + }; + } +} diff --git a/src/displayapp/DisplayApp.cpp b/src/displayapp/DisplayApp.cpp index 6e3fd0bf..4e9042ab 100644 --- a/src/displayapp/DisplayApp.cpp +++ b/src/displayapp/DisplayApp.cpp @@ -25,6 +25,7 @@ #include "systemtask/SystemTask.h" using namespace Pinetime::Applications; +using namespace Pinetime::Applications::Display; DisplayApp::DisplayApp(Drivers::St7789 &lcd, Components::LittleVgl &lvgl, Drivers::Cst816S &touchPanel, Controllers::Battery &batteryController, Controllers::Ble &bleController, @@ -220,7 +221,7 @@ void DisplayApp::IdleState() { } -void DisplayApp::PushMessage(DisplayApp::Messages msg) { +void DisplayApp::PushMessage(Messages msg) { BaseType_t xHigherPriorityTaskWoken; xHigherPriorityTaskWoken = pdFALSE; xQueueSendFromISR(msgQueue, &msg, &xHigherPriorityTaskWoken); diff --git a/src/displayapp/DisplayApp.h b/src/displayapp/DisplayApp.h index c38404ba..9a3d1191 100644 --- a/src/displayapp/DisplayApp.h +++ b/src/displayapp/DisplayApp.h @@ -10,6 +10,7 @@ #include "components/brightness/BrightnessController.h" #include "components/firmwarevalidator/FirmwareValidator.h" #include "displayapp/screens/Screen.h" +#include "Messages.h" namespace Pinetime { @@ -33,9 +34,6 @@ namespace Pinetime { class DisplayApp { public: enum class States {Idle, Running}; - enum class Messages : uint8_t {GoToSleep, GoToRunning, UpdateDateTime, UpdateBleConnection, UpdateBatteryLevel, TouchEvent, ButtonPushed, - NewNotification, BleFirmwareUpdateStarted }; - enum class FullRefreshDirections { None, Up, Down }; enum class TouchModes { Gestures, Polling }; @@ -46,7 +44,7 @@ namespace Pinetime { Pinetime::Controllers::NotificationManager& notificationManager, Pinetime::Controllers::HeartRateController& heartRateController); void Start(); - void PushMessage(Messages msg); + void PushMessage(Display::Messages msg); void StartApp(Apps app); diff --git a/src/displayapp/DisplayAppRecovery.cpp b/src/displayapp/DisplayAppRecovery.cpp new file mode 100644 index 00000000..cccb72d3 --- /dev/null +++ b/src/displayapp/DisplayAppRecovery.cpp @@ -0,0 +1,110 @@ +#include "DisplayAppRecovery.h" +#include "DisplayAppRecovery.h" +#include <FreeRTOS.h> +#include <task.h> +#include <libraries/log/nrf_log.h> +#include <components/rle/RleDecoder.h> +#include "displayapp/icons/infinitime/infinitime-nb.c" + +using namespace Pinetime::Applications; + +DisplayApp::DisplayApp(Drivers::St7789 &lcd, Components::LittleVgl &lvgl, Drivers::Cst816S &touchPanel, + Controllers::Battery &batteryController, Controllers::Ble &bleController, + Controllers::DateTime &dateTimeController, Drivers::WatchdogView &watchdog, + System::SystemTask &systemTask, + Pinetime::Controllers::NotificationManager& notificationManager, + Pinetime::Controllers::HeartRateController& heartRateController): + lcd{lcd}, bleController{bleController} { + msgQueue = xQueueCreate(queueSize, itemSize); + +} + +void DisplayApp::Start() { + if (pdPASS != xTaskCreate(DisplayApp::Process, "displayapp", 512, this, 0, &taskHandle)) + APP_ERROR_HANDLER(NRF_ERROR_NO_MEM); +} + +void DisplayApp::Process(void *instance) { + auto *app = static_cast<DisplayApp *>(instance); + NRF_LOG_INFO("displayapp task started!"); + + // Send a dummy notification to unlock the lvgl display driver for the first iteration + xTaskNotifyGive(xTaskGetCurrentTaskHandle()); + + app->InitHw(); + while (1) { + app->Refresh(); + } +} + +void DisplayApp::InitHw() { + DisplayLogo(colorWhite); +} + +void DisplayApp::Refresh() { + Display::Messages msg; + if (xQueueReceive(msgQueue, &msg, 200)) { + switch (msg) { + case Display::Messages::UpdateBleConnection: + if (bleController.IsConnected()) + DisplayLogo(colorBlue); + else + DisplayLogo(colorWhite); + break; + case Display::Messages::BleFirmwareUpdateStarted: + DisplayLogo(colorGreen); + break; + default: + break; + } + } + + if (bleController.IsFirmwareUpdating()) { + uint8_t percent = (static_cast<float>(bleController.FirmwareUpdateCurrentBytes()) / + static_cast<float>(bleController.FirmwareUpdateTotalBytes())) * 100.0f; + switch (bleController.State()) { + case Controllers::Ble::FirmwareUpdateStates::Running: + DisplayOtaProgress(percent, colorWhite); + break; + case Controllers::Ble::FirmwareUpdateStates::Validated: + DisplayOtaProgress(100, colorGreenSwapped); + break; + case Controllers::Ble::FirmwareUpdateStates::Error: + DisplayOtaProgress(100, colorRedSwapped); + break; + default: + break; + } + } +} + +void DisplayApp::DisplayLogo(uint16_t color) { + Pinetime::Tools::RleDecoder rleDecoder(infinitime_nb, sizeof(infinitime_nb), color, colorBlack); + for(int i = 0; i < displayWidth; i++) { + rleDecoder.DecodeNext(displayBuffer, displayWidth * bytesPerPixel); + ulTaskNotifyTake(pdTRUE, 500); + lcd.BeginDrawBuffer(0, i, displayWidth, 1); + lcd.NextDrawBuffer(reinterpret_cast<const uint8_t *>(displayBuffer), displayWidth * bytesPerPixel); + } +} + +void DisplayApp::DisplayOtaProgress(uint8_t percent, uint16_t color) { + const uint8_t barHeight = 20; + std::fill(displayBuffer, displayBuffer+(displayWidth * bytesPerPixel), color); + for(int i = 0; i < barHeight; i++) { + ulTaskNotifyTake(pdTRUE, 500); + uint16_t barWidth = std::min(static_cast<float>(percent) * 2.4f, static_cast<float>(displayWidth)); + lcd.BeginDrawBuffer(0, displayWidth - barHeight + i, barWidth, 1); + lcd.NextDrawBuffer(reinterpret_cast<const uint8_t *>(displayBuffer), barWidth * bytesPerPixel); + } +} + +void DisplayApp::PushMessage(Display::Messages msg) { + BaseType_t xHigherPriorityTaskWoken; + xHigherPriorityTaskWoken = pdFALSE; + xQueueSendFromISR(msgQueue, &msg, &xHigherPriorityTaskWoken); + if (xHigherPriorityTaskWoken) { + /* Actual macro used here is port specific. */ + // TODO : should I do something here? + } +}
\ No newline at end of file diff --git a/src/displayapp/DisplayAppRecovery.h b/src/displayapp/DisplayAppRecovery.h new file mode 100644 index 00000000..bcabea3a --- /dev/null +++ b/src/displayapp/DisplayAppRecovery.h @@ -0,0 +1,71 @@ +#pragma once +#include <FreeRTOS.h> +#include <task.h> +#include <drivers/St7789.h> +#include <drivers/SpiMaster.h> +#include <bits/unique_ptr.h> +#include <queue.h> +#include "components/gfx/Gfx.h" +#include "components/battery/BatteryController.h" +#include "components/brightness/BrightnessController.h" +#include "components/ble/BleController.h" +#include "components/datetime/DateTimeController.h" +#include "components/ble/NotificationManager.h" +#include "components/firmwarevalidator/FirmwareValidator.h" +#include "drivers/Cst816s.h" +#include <date/date.h> +#include "displayapp/screens/Clock.h" +#include <drivers/Watchdog.h> +#include "TouchEvents.h" +#include "Apps.h" +#include "Messages.h" +#include "DummyLittleVgl.h" + +namespace Pinetime { + namespace System { + class SystemTask; + }; + namespace Applications { + class DisplayApp { + public: + DisplayApp(Drivers::St7789 &lcd, Components::LittleVgl &lvgl, Drivers::Cst816S &, + Controllers::Battery &batteryController, Controllers::Ble &bleController, + Controllers::DateTime &dateTimeController, Drivers::WatchdogView &watchdog, + System::SystemTask &systemTask, + Pinetime::Controllers::NotificationManager& notificationManager, + Pinetime::Controllers::HeartRateController& heartRateController); + void Start(); + void PushMessage(Pinetime::Applications::Display::Messages msg); + + private: + TaskHandle_t taskHandle; + static void Process(void* instance); + void DisplayLogo(uint16_t color); + void DisplayOtaProgress(uint8_t percent, uint16_t color); + void InitHw(); + void Refresh(); + Pinetime::Drivers::St7789& lcd; + Controllers::Ble &bleController; + + static constexpr uint8_t queueSize = 10; + static constexpr uint8_t itemSize = 1; + QueueHandle_t msgQueue; + static constexpr uint8_t displayWidth = 240; + static constexpr uint8_t displayHeight = 240; + static constexpr uint8_t bytesPerPixel = 2; + + static constexpr uint16_t colorWhite = 0xFFFF; + static constexpr uint16_t colorGreen = 0x07E0; + static constexpr uint16_t colorGreenSwapped = 0xE007; + static constexpr uint16_t colorBlue = 0x0000ff; + static constexpr uint16_t colorRed = 0xff00; + static constexpr uint16_t colorRedSwapped = 0x00ff; + static constexpr uint16_t colorBlack = 0x0000; + uint8_t displayBuffer[displayWidth * bytesPerPixel]; + + + }; + } +} + + diff --git a/src/displayapp/DummyLittleVgl.h b/src/displayapp/DummyLittleVgl.h new file mode 100644 index 00000000..1c60911c --- /dev/null +++ b/src/displayapp/DummyLittleVgl.h @@ -0,0 +1,30 @@ +#pragma once + +#include <libs/lvgl/src/lv_core/lv_style.h> +#include <libs/lvgl/src/lv_themes/lv_theme.h> +#include <libs/lvgl/src/lv_hal/lv_hal.h> +#include <drivers/St7789.h> +#include <drivers/Cst816s.h> + +namespace Pinetime { + namespace Components { + class LittleVgl { + public: + enum class FullRefreshDirections { None, Up, Down }; + LittleVgl(Pinetime::Drivers::St7789& lcd, Pinetime::Drivers::Cst816S& touchPanel) {} + + LittleVgl(const LittleVgl&) = delete; + LittleVgl& operator=(const LittleVgl&) = delete; + LittleVgl(LittleVgl&&) = delete; + LittleVgl& operator=(LittleVgl&&) = delete; + + void FlushDisplay(const lv_area_t * area, lv_color_t * color_p) {} + bool GetTouchPadInfo(lv_indev_data_t *ptr) {return false;} + void SetFullRefresh(FullRefreshDirections direction) {} + void SetNewTapEvent(uint16_t x, uint16_t y) {} + + + }; + } +} + diff --git a/src/displayapp/Messages.h b/src/displayapp/Messages.h new file mode 100644 index 00000000..f617774d --- /dev/null +++ b/src/displayapp/Messages.h @@ -0,0 +1,11 @@ +#pragma once +namespace Pinetime { + namespace Applications { + namespace Display { + enum class Messages : uint8_t { + GoToSleep, GoToRunning, UpdateDateTime, UpdateBleConnection, UpdateBatteryLevel, TouchEvent, ButtonPushed, + NewNotification, BleFirmwareUpdateStarted + }; + } + } +}
\ No newline at end of file diff --git a/src/displayapp/icons/infinitime/infinitime-nb.c b/src/displayapp/icons/infinitime/infinitime-nb.c new file mode 100644 index 00000000..52f18541 --- /dev/null +++ b/src/displayapp/icons/infinitime/infinitime-nb.c @@ -0,0 +1,127 @@ + +#include <unistd.h> + +// 1-bit RLE, generated from ./infinitime-nb.png, 1445 bytes +static const uint8_t infinitime_nb[] = { + 0xff, 0x0, 0xff, 0x0, 0xff, 0x0, 0xff, 0x0, 0xff, 0x0, 0xff, 0x0, + 0xff, 0x0, 0xff, 0x0, 0xff, 0x0, 0xff, 0x0, 0xff, 0x0, 0xff, 0x0, + 0xff, 0x0, 0xff, 0x0, 0xff, 0x0, 0x66, 0x2, 0xed, 0x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ff, 0x0, 0xff, 0x0, 0xff, 0x0, 0xff, 0x0, + 0xff, 0x0, 0xff, 0x0, 0xff, 0x0, 0xff, 0x0, 0xff, 0x0, 0xff, 0x0, + 0xff, 0x0, 0xff, 0x0, 0xff, 0x0, 0xff, 0x0, 0xff, 0x0, 0xff, 0x0, + 0xff, 0x0, 0xff, 0x0, 0xec, +}; diff --git a/src/displayapp/icons/infinitime/infinitime-nb.png b/src/displayapp/icons/infinitime/infinitime-nb.png Binary files differnew file mode 100644 index 00000000..e425b060 --- /dev/null +++ b/src/displayapp/icons/infinitime/infinitime-nb.png diff --git a/src/libs/lvgl b/src/libs/lvgl -Subproject b89c30eafe1397a778ae5d65f108a0ef820de12 +Subproject 69a50b97dafffddd212e4b006776b473951be7a diff --git a/src/main.cpp b/src/main.cpp index fe177d0d..03cb1687 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -32,8 +32,6 @@ #include "components/ble/NotificationManager.h" #include "components/motor/MotorController.h" #include "components/datetime/DateTimeController.h" -#include "displayapp/DisplayApp.h" -#include "displayapp/LittleVgl.h" #include "drivers/Spi.h" #include "drivers/SpiMaster.h" #include "drivers/SpiNorFlash.h" @@ -85,7 +83,18 @@ Pinetime::Drivers::TwiMaster twiMaster{Pinetime::Drivers::TwiMaster::Modules::TW Pinetime::Drivers::TwiMaster::Parameters { MaxTwiFrequencyWithoutHardwareBug, pinTwiSda, pinTwiScl}}; Pinetime::Drivers::Cst816S touchPanel {twiMaster, touchPanelTwiAddress}; +#ifdef PINETIME_IS_RECOVERY +static constexpr bool isFactory = true; +#include "displayapp/DummyLittleVgl.h" +#include "displayapp/DisplayAppRecovery.h" +Pinetime::Components::LittleVgl lvgl {lcd, touchPanel}; +#else +static constexpr bool isFactory = false; +#include "displayapp/LittleVgl.h" +#include "displayapp/DisplayApp.h" Pinetime::Components::LittleVgl lvgl {lcd, touchPanel}; +#endif + Pinetime::Drivers::Hrs3300 heartRateSensor {twiMaster, heartRateSensorTwiAddress}; @@ -114,7 +123,8 @@ void nrfx_gpiote_evt_handler(nrfx_gpiote_pin_t pin, nrf_gpiote_polarity_t action extern "C" { void vApplicationIdleHook(void) { - lv_tick_inc(1); + if(!isFactory) + lv_tick_inc(1); } } diff --git a/src/graphics.cpp b/src/recoveryLoader.cpp index 288b5e9a..40cd66da 100644 --- a/src/graphics.cpp +++ b/src/recoveryLoader.cpp @@ -4,7 +4,6 @@ #include <drivers/Spi.h> #include <drivers/SpiNorFlash.h> #include <libraries/log/nrf_log.h> -#include "bootloader/boot_graphics.h" #include <FreeRTOS.h> #include <task.h> #include <legacy/nrf_drv_gpiote.h> @@ -14,6 +13,12 @@ #include <components/gfx/Gfx.h> #include <drivers/St7789.h> #include <components/brightness/BrightnessController.h> +#include <algorithm> +#include "recoveryImage.h" + +#include "displayapp/icons/infinitime/infinitime-nb.c" +#include "components/rle/RleDecoder.h" + #if NRF_LOG_ENABLED #include "logging/NrfLogger.h" @@ -30,14 +35,21 @@ static constexpr uint8_t pinSpiFlashCsn = 5; static constexpr uint8_t pinLcdCsn = 25; static constexpr uint8_t pinLcdDataCommand = 18; +static constexpr uint8_t displayWidth = 240; +static constexpr uint8_t displayHeight = 240; +static constexpr uint8_t bytesPerPixel = 2; + +static constexpr uint16_t colorWhite = 0xFFFF; +static constexpr uint16_t colorGreen = 0xE007; + Pinetime::Drivers::SpiMaster spi{Pinetime::Drivers::SpiMaster::SpiModule::SPI0, { - Pinetime::Drivers::SpiMaster::BitOrder::Msb_Lsb, - Pinetime::Drivers::SpiMaster::Modes::Mode3, - Pinetime::Drivers::SpiMaster::Frequencies::Freq8Mhz, - pinSpiSck, - pinSpiMosi, - pinSpiMiso - } + Pinetime::Drivers::SpiMaster::BitOrder::Msb_Lsb, + Pinetime::Drivers::SpiMaster::Modes::Mode3, + Pinetime::Drivers::SpiMaster::Frequencies::Freq8Mhz, + pinSpiSck, + pinSpiMosi, + pinSpiMiso +} }; Pinetime::Drivers::Spi flashSpi{spi, pinSpiFlashCsn}; Pinetime::Drivers::SpiNorFlash spiNorFlash{flashSpi}; @@ -48,6 +60,10 @@ Pinetime::Drivers::St7789 lcd {lcdSpi, pinLcdDataCommand}; Pinetime::Components::Gfx gfx{lcd}; Pinetime::Controllers::BrightnessController brightnessController; +void DisplayProgressBar(uint8_t percent, uint16_t color); + +void DisplayLogo(); + extern "C" { void vApplicationIdleHook(void) { @@ -70,10 +86,13 @@ void SPIM0_SPIS0_TWIM0_TWIS0_SPI0_TWI0_IRQHandler(void) { } } -void Process(void* instance) { - // Wait before erasing the memory to let the time to the SWD debugger to flash a new firmware before running this one. - vTaskDelay(5000); +void RefreshWatchdog() { + NRF_WDT->RR[0] = WDT_RR_RR_Reload; +} +uint8_t displayBuffer[displayWidth * bytesPerPixel]; +void Process(void* instance) { + RefreshWatchdog(); APP_GPIOTE_INIT(2); NRF_LOG_INFO("Init..."); @@ -83,45 +102,57 @@ void Process(void* instance) { brightnessController.Init(); lcd.Init(); gfx.Init(); - NRF_LOG_INFO("Init Done!") + + NRF_LOG_INFO("Display logo") + DisplayLogo(); NRF_LOG_INFO("Erasing..."); - for (uint32_t erased = 0; erased < graphicSize; erased += 0x1000) { + for (uint32_t erased = 0; erased < sizeof(recoveryImage); erased += 0x1000) { spiNorFlash.SectorErase(erased); + RefreshWatchdog(); } - NRF_LOG_INFO("Erase done!"); - NRF_LOG_INFO("Writing graphic..."); + NRF_LOG_INFO("Writing factory image..."); static constexpr uint32_t memoryChunkSize = 200; uint8_t writeBuffer[memoryChunkSize]; - for(int offset = 0; offset < 115200; offset+=memoryChunkSize) { - std::memcpy(writeBuffer, &graphicBuffer[offset], memoryChunkSize); + for(size_t offset = 0; offset < sizeof(recoveryImage); offset+=memoryChunkSize) { + std::memcpy(writeBuffer, &recoveryImage[offset], memoryChunkSize); spiNorFlash.Write(offset, writeBuffer, memoryChunkSize); + DisplayProgressBar((static_cast<float>(offset) / static_cast<float>(sizeof(recoveryImage))) * 100.0f, colorWhite); + RefreshWatchdog(); } - NRF_LOG_INFO("Writing graphic done!"); - - NRF_LOG_INFO("Read memory and display the graphic..."); - static constexpr uint32_t screenWidth = 240; - static constexpr uint32_t screenWidthInBytes = screenWidth*2; // LCD display 16bits color (1 pixel = 2 bytes) - uint16_t displayLineBuffer[screenWidth]; - for(uint32_t line = 0; line < screenWidth; line++) { - spiNorFlash.Read(line*screenWidthInBytes, reinterpret_cast<uint8_t *>(displayLineBuffer), screenWidth); - spiNorFlash.Read((line*screenWidthInBytes)+screenWidth, reinterpret_cast<uint8_t *>(displayLineBuffer) + screenWidth, screenWidth); - for(uint32_t col = 0; col < screenWidth; col++) { - gfx.pixel_draw(col, line, displayLineBuffer[col]); - } - } - - NRF_LOG_INFO("Done!"); + NRF_LOG_INFO("Writing factory image done!"); + DisplayProgressBar(100.0f, colorGreen); while(1) { asm("nop" ); } } +void DisplayLogo() { + Pinetime::Tools::RleDecoder rleDecoder(infinitime_nb, sizeof(infinitime_nb)); + for(int i = 0; i < displayWidth; i++) { + rleDecoder.DecodeNext(displayBuffer, displayWidth * bytesPerPixel); + ulTaskNotifyTake(pdTRUE, 500); + lcd.BeginDrawBuffer(0, i, displayWidth, 1); + lcd.NextDrawBuffer(reinterpret_cast<const uint8_t *>(displayBuffer), displayWidth * bytesPerPixel); + } +} + +void DisplayProgressBar(uint8_t percent, uint16_t color) { + static constexpr uint8_t barHeight = 20; + std::fill(displayBuffer, displayBuffer+(displayWidth * bytesPerPixel), color); + for(int i = 0; i < barHeight; i++) { + ulTaskNotifyTake(pdTRUE, 500); + uint16_t barWidth = std::min(static_cast<float>(percent) * 2.4f, static_cast<float>(displayWidth)); + lcd.BeginDrawBuffer(0, displayWidth - barHeight + i, barWidth, 1); + lcd.NextDrawBuffer(reinterpret_cast<const uint8_t *>(displayBuffer), barWidth * bytesPerPixel); + } +} + int main(void) { TaskHandle_t taskHandle; - + RefreshWatchdog(); logger.Init(); nrf_drv_clock_init(); diff --git a/src/systemtask/SystemTask.cpp b/src/systemtask/SystemTask.cpp index 6e6360a4..a4f2b14a 100644 --- a/src/systemtask/SystemTask.cpp +++ b/src/systemtask/SystemTask.cpp @@ -14,7 +14,6 @@ #include "BootloaderVersion.h" #include "components/ble/BleController.h" -#include "displayapp/LittleVgl.h" #include "drivers/Cst816s.h" #include "drivers/St7789.h" #include "drivers/InternalFlash.h" @@ -74,6 +73,7 @@ void SystemTask::Work() { spiNorFlash.Wakeup(); nimbleController.Init(); nimbleController.StartAdvertising(); + brightnessController.Init(); lcd.Init(); twiMaster.Init(); @@ -88,7 +88,7 @@ void SystemTask::Work() { displayApp->Start(); batteryController.Update(); - displayApp->PushMessage(Pinetime::Applications::DisplayApp::Messages::UpdateBatteryLevel); + displayApp->PushMessage(Pinetime::Applications::Display::Messages::UpdateBatteryLevel); heartRateSensor.Init(); heartRateSensor.Disable(); @@ -141,8 +141,8 @@ void SystemTask::Work() { touchPanel.Wakeup(); lcd.Wakeup(); - displayApp->PushMessage(Applications::DisplayApp::Messages::GoToRunning); - displayApp->PushMessage(Applications::DisplayApp::Messages::UpdateBatteryLevel); + displayApp->PushMessage(Pinetime::Applications::Display::Messages::GoToRunning); + displayApp->PushMessage(Pinetime::Applications::Display::Messages::UpdateBatteryLevel); heartRateApp->PushMessage(Pinetime::Applications::HeartRateTask::Messages::WakeUp); isSleeping = false; @@ -152,17 +152,17 @@ void SystemTask::Work() { isGoingToSleep = true; NRF_LOG_INFO("[systemtask] Going to sleep"); xTimerStop(idleTimer, 0); - displayApp->PushMessage(Pinetime::Applications::DisplayApp::Messages::GoToSleep); + displayApp->PushMessage(Pinetime::Applications::Display::Messages::GoToSleep); heartRateApp->PushMessage(Pinetime::Applications::HeartRateTask::Messages::GoToSleep); break; case Messages::OnNewTime: ReloadIdleTimer(); - displayApp->PushMessage(Pinetime::Applications::DisplayApp::Messages::UpdateDateTime); + displayApp->PushMessage(Pinetime::Applications::Display::Messages::UpdateDateTime); break; case Messages::OnNewNotification: if(isSleeping && !isWakingUp) GoToRunning(); if(notificationManager.IsVibrationEnabled()) motorController.SetDuration(35); - displayApp->PushMessage(Pinetime::Applications::DisplayApp::Messages::NewNotification); + displayApp->PushMessage(Pinetime::Applications::Display::Messages::NewNotification); break; case Messages::BleConnected: ReloadIdleTimer(); @@ -172,7 +172,7 @@ void SystemTask::Work() { case Messages::BleFirmwareUpdateStarted: doNotGoToSleep = true; if(isSleeping && !isWakingUp) GoToRunning(); - displayApp->PushMessage(Pinetime::Applications::DisplayApp::Messages::BleFirmwareUpdateStarted); + displayApp->PushMessage(Pinetime::Applications::Display::Messages::BleFirmwareUpdateStarted); break; case Messages::BleFirmwareUpdateFinished: doNotGoToSleep = false; @@ -230,7 +230,7 @@ void SystemTask::OnButtonPushed() { if(!isSleeping) { NRF_LOG_INFO("[systemtask] Button pushed"); PushMessage(Messages::OnButtonEvent); - displayApp->PushMessage(Pinetime::Applications::DisplayApp::Messages::ButtonPushed); + displayApp->PushMessage(Pinetime::Applications::Display::Messages::ButtonPushed); } else { if(!isWakingUp) { @@ -250,7 +250,7 @@ void SystemTask::OnTouchEvent() { NRF_LOG_INFO("[systemtask] Touch event"); if(!isSleeping) { PushMessage(Messages::OnTouchEvent); - displayApp->PushMessage(Pinetime::Applications::DisplayApp::Messages::TouchEvent); + displayApp->PushMessage(Pinetime::Applications::Display::Messages::TouchEvent); } } diff --git a/src/systemtask/SystemTask.h b/src/systemtask/SystemTask.h index c650d085..eadbc72d 100644 --- a/src/systemtask/SystemTask.h +++ b/src/systemtask/SystemTask.h @@ -13,7 +13,14 @@ #include "components/ble/NimbleController.h" #include "components/ble/NotificationManager.h" #include "components/motor/MotorController.h" +#ifdef PINETIME_IS_RECOVERY +#include "displayapp/DisplayAppRecovery.h" +#include "displayapp/DummyLittleVgl.h" +#else #include "displayapp/DisplayApp.h" +#include "displayapp/LittleVgl.h" +#endif + #include "drivers/Watchdog.h" namespace Pinetime { @@ -78,6 +85,7 @@ namespace Pinetime { Pinetime::Controllers::MotorController& motorController; Pinetime::Drivers::Hrs3300& heartRateSensor; Pinetime::Controllers::NimbleController nimbleController; + Controllers::BrightnessController brightnessController; static constexpr uint8_t pinSpiSck = 2; static constexpr uint8_t pinSpiMosi = 3; |