Disable DisplayApp and Nimble : Binary size : from 260K to 160K.

This commit is contained in:
JF 2020-11-01 14:36:55 +01:00
parent 0e97db1c30
commit 2488777e27
6 changed files with 48 additions and 20 deletions

View File

@ -382,7 +382,9 @@ list(APPEND SOURCE_FILES
systemtask/SystemTask.cpp systemtask/SystemTask.cpp
drivers/TwiMaster.cpp drivers/TwiMaster.cpp
) components/gfx/Gfx.cpp
)
list(APPEND GRAPHICS_SOURCE_FILES list(APPEND GRAPHICS_SOURCE_FILES
# FreeRTOS # FreeRTOS

View File

@ -13,7 +13,7 @@
#include "components/ble/NotificationManager.h" #include "components/ble/NotificationManager.h"
#include "components/firmwarevalidator/FirmwareValidator.h" #include "components/firmwarevalidator/FirmwareValidator.h"
#include "drivers/Cst816s.h" #include "drivers/Cst816s.h"
#include "LittleVgl.h" #include "DummyLittleVgl.h"
#include <date/date.h> #include <date/date.h>
#include "displayapp/screens/Clock.h" #include "displayapp/screens/Clock.h"
#include "displayapp/screens/Modal.h" #include "displayapp/screens/Modal.h"

View File

@ -6,7 +6,7 @@
#include <libs/lvgl/src/lv_core/lv_style.h> #include <libs/lvgl/src/lv_core/lv_style.h>
#include <libs/lvgl/src/lv_core/lv_obj.h> #include <libs/lvgl/src/lv_core/lv_obj.h>
#include <drivers/St7789.h> #include <drivers/St7789.h>
#include "displayapp/LittleVgl.h" #include "displayapp/DummyLittleVgl.h"
namespace Pinetime { namespace Pinetime {
namespace Applications { namespace Applications {

View File

@ -16,7 +16,7 @@
#include <drivers/St7789.h> #include <drivers/St7789.h>
#include <drivers/SpiMaster.h> #include <drivers/SpiMaster.h>
#include <drivers/Spi.h> #include <drivers/Spi.h>
#include "displayapp/LittleVgl.h" #include "displayapp/DummyLittleVgl.h"
#include <systemtask/SystemTask.h> #include <systemtask/SystemTask.h>
#include <nimble/nimble_port_freertos.h> #include <nimble/nimble_port_freertos.h>
#include <nimble/npl_freertos.h> #include <nimble/npl_freertos.h>

View File

@ -1,7 +1,7 @@
#include <libraries/log/nrf_log.h> #include <libraries/log/nrf_log.h>
#include <libraries/gpiote/app_gpiote.h> #include <libraries/gpiote/app_gpiote.h>
#include <drivers/Cst816s.h> #include <drivers/Cst816s.h>
#include "displayapp/LittleVgl.h" #include "displayapp/DummyLittleVgl.h"
#include <hal/nrf_rtc.h> #include <hal/nrf_rtc.h>
#include "components/ble/NotificationManager.h" #include "components/ble/NotificationManager.h"
#include <host/ble_gatt.h> #include <host/ble_gatt.h>
@ -33,7 +33,7 @@ SystemTask::SystemTask(Drivers::SpiMaster &spi, Drivers::St7789 &lcd,
Controllers::DateTime &dateTimeController, Controllers::DateTime &dateTimeController,
Pinetime::Controllers::NotificationManager& notificationManager) : Pinetime::Controllers::NotificationManager& notificationManager) :
spi{spi}, lcd{lcd}, spiNorFlash{spiNorFlash}, spi{spi}, lcd{lcd}, spiNorFlash{spiNorFlash},
twiMaster{twiMaster}, touchPanel{touchPanel}, lvgl{lvgl}, batteryController{batteryController}, twiMaster{twiMaster}, touchPanel{touchPanel}, lvgl{lvgl}, batteryController{batteryController}, gfx{lcd},
bleController{bleController}, dateTimeController{dateTimeController}, bleController{bleController}, dateTimeController{dateTimeController},
watchdog{}, watchdogView{watchdog}, notificationManager{notificationManager}, watchdog{}, watchdogView{watchdog}, notificationManager{notificationManager},
nimbleController(*this, bleController,dateTimeController, notificationManager, batteryController, spiNorFlash) { nimbleController(*this, bleController,dateTimeController, notificationManager, batteryController, spiNorFlash) {
@ -62,18 +62,23 @@ void SystemTask::Work() {
spiNorFlash.Wakeup(); spiNorFlash.Wakeup();
nimbleController.Init(); nimbleController.Init();
nimbleController.StartAdvertising(); nimbleController.StartAdvertising();
lcd.Init(); brightnessController.Init();
lcd.Init();
lcd.VerticalScrollDefinition(0, 240, 0);
lcd.VerticalScrollStartAddress(0);
gfx.Init();
twiMaster.Init(); twiMaster.Init();
touchPanel.Init(); touchPanel.Init();
batteryController.Init(); batteryController.Init();
displayApp.reset(new Pinetime::Applications::DisplayApp(lcd, lvgl, touchPanel, batteryController, bleController, // displayApp.reset(new Pinetime::Applications::DisplayApp(lcd, lvgl, touchPanel, batteryController, bleController,
dateTimeController, watchdogView, *this, notificationManager)); // dateTimeController, watchdogView, *this, notificationManager));
displayApp->Start(); // displayApp->Start();
batteryController.Update(); batteryController.Update();
displayApp->PushMessage(Pinetime::Applications::DisplayApp::Messages::UpdateBatteryLevel); // displayApp->PushMessage(Pinetime::Applications::DisplayApp::Messages::UpdateBatteryLevel);
nrf_gpio_cfg_sense_input(pinButton, (nrf_gpio_pin_pull_t)GPIO_PIN_CNF_PULL_Pulldown, (nrf_gpio_pin_sense_t)GPIO_PIN_CNF_SENSE_High); nrf_gpio_cfg_sense_input(pinButton, (nrf_gpio_pin_pull_t)GPIO_PIN_CNF_PULL_Pulldown, (nrf_gpio_pin_sense_t)GPIO_PIN_CNF_SENSE_High);
nrf_gpio_cfg_output(15); nrf_gpio_cfg_output(15);
@ -117,8 +122,8 @@ void SystemTask::Work() {
lcd.Wakeup(); lcd.Wakeup();
touchPanel.Wakeup(); touchPanel.Wakeup();
displayApp->PushMessage(Applications::DisplayApp::Messages::GoToRunning); // displayApp->PushMessage(Applications::DisplayApp::Messages::GoToRunning);
displayApp->PushMessage(Applications::DisplayApp::Messages::UpdateBatteryLevel); // displayApp->PushMessage(Applications::DisplayApp::Messages::UpdateBatteryLevel);
xTimerStart(idleTimer, 0); xTimerStart(idleTimer, 0);
nimbleController.StartAdvertising(); nimbleController.StartAdvertising();
@ -129,15 +134,15 @@ void SystemTask::Work() {
isGoingToSleep = true; isGoingToSleep = true;
NRF_LOG_INFO("[systemtask] Going to sleep"); NRF_LOG_INFO("[systemtask] Going to sleep");
xTimerStop(idleTimer, 0); xTimerStop(idleTimer, 0);
displayApp->PushMessage(Pinetime::Applications::DisplayApp::Messages::GoToSleep); // displayApp->PushMessage(Pinetime::Applications::DisplayApp::Messages::GoToSleep);
break; break;
case Messages::OnNewTime: case Messages::OnNewTime:
ReloadIdleTimer(); ReloadIdleTimer();
displayApp->PushMessage(Pinetime::Applications::DisplayApp::Messages::UpdateDateTime); // displayApp->PushMessage(Pinetime::Applications::DisplayApp::Messages::UpdateDateTime);
break; break;
case Messages::OnNewNotification: case Messages::OnNewNotification:
if(isSleeping && !isWakingUp) GoToRunning(); if(isSleeping && !isWakingUp) GoToRunning();
displayApp->PushMessage(Pinetime::Applications::DisplayApp::Messages::NewNotification); // displayApp->PushMessage(Pinetime::Applications::DisplayApp::Messages::NewNotification);
break; break;
case Messages::BleConnected: case Messages::BleConnected:
ReloadIdleTimer(); ReloadIdleTimer();
@ -147,7 +152,7 @@ void SystemTask::Work() {
case Messages::BleFirmwareUpdateStarted: case Messages::BleFirmwareUpdateStarted:
doNotGoToSleep = true; doNotGoToSleep = true;
if(isSleeping && !isWakingUp) GoToRunning(); if(isSleeping && !isWakingUp) GoToRunning();
displayApp->PushMessage(Pinetime::Applications::DisplayApp::Messages::BleFirmwareUpdateStarted); // displayApp->PushMessage(Pinetime::Applications::DisplayApp::Messages::BleFirmwareUpdateStarted);
break; break;
case Messages::BleFirmwareUpdateFinished: case Messages::BleFirmwareUpdateFinished:
doNotGoToSleep = false; doNotGoToSleep = false;
@ -195,6 +200,25 @@ void SystemTask::Work() {
batteryController.Update(); batteryController.Update();
monitor.Process(); monitor.Process();
static bool hello = false;
if(hello) {
for (int i = 0; i < 10; i++) {
for (int j = 0; j < 10; j++) {
lcd.DrawPixel(j, i, 0xffff);
}
}
}
else {
for (int i = 0; i < 10; i++) {
for (int j = 0; j < 10; j++) {
lcd.DrawPixel(j, i, 0x0);
}
}
}
hello = !hello;
if(!nrf_gpio_pin_read(pinButton)) if(!nrf_gpio_pin_read(pinButton))
watchdog.Kick(); watchdog.Kick();
@ -208,7 +232,7 @@ void SystemTask::OnButtonPushed() {
if(!isSleeping) { if(!isSleeping) {
NRF_LOG_INFO("[systemtask] Button pushed"); NRF_LOG_INFO("[systemtask] Button pushed");
PushMessage(Messages::OnButtonEvent); PushMessage(Messages::OnButtonEvent);
displayApp->PushMessage(Pinetime::Applications::DisplayApp::Messages::ButtonPushed); // displayApp->PushMessage(Pinetime::Applications::DisplayApp::Messages::ButtonPushed);
} }
else { else {
if(!isWakingUp) { if(!isWakingUp) {
@ -228,7 +252,7 @@ void SystemTask::OnTouchEvent() {
NRF_LOG_INFO("[systemtask] Touch event"); NRF_LOG_INFO("[systemtask] Touch event");
if(!isSleeping) { if(!isSleeping) {
PushMessage(Messages::OnTouchEvent); PushMessage(Messages::OnTouchEvent);
displayApp->PushMessage(Pinetime::Applications::DisplayApp::Messages::TouchEvent); // displayApp->PushMessage(Pinetime::Applications::DisplayApp::Messages::TouchEvent);
} }
} }

View File

@ -51,7 +51,8 @@ namespace Pinetime {
Pinetime::Drivers::Cst816S& touchPanel; Pinetime::Drivers::Cst816S& touchPanel;
Pinetime::Components::LittleVgl& lvgl; Pinetime::Components::LittleVgl& lvgl;
Pinetime::Controllers::Battery& batteryController; Pinetime::Controllers::Battery& batteryController;
std::unique_ptr<Pinetime::Applications::DisplayApp> displayApp; //std::unique_ptr<Pinetime::Applications::DisplayApp> displayApp;
Pinetime::Components::Gfx gfx;
Pinetime::Controllers::Ble& bleController; Pinetime::Controllers::Ble& bleController;
Pinetime::Controllers::DateTime& dateTimeController; Pinetime::Controllers::DateTime& dateTimeController;
QueueHandle_t systemTasksMsgQueue; QueueHandle_t systemTasksMsgQueue;
@ -62,6 +63,7 @@ namespace Pinetime {
Pinetime::Drivers::WatchdogView watchdogView; Pinetime::Drivers::WatchdogView watchdogView;
Pinetime::Controllers::NotificationManager& notificationManager; Pinetime::Controllers::NotificationManager& notificationManager;
Pinetime::Controllers::NimbleController nimbleController; Pinetime::Controllers::NimbleController nimbleController;
Controllers::BrightnessController brightnessController;
static constexpr uint8_t pinSpiSck = 2; static constexpr uint8_t pinSpiSck = 2;