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
drivers/TwiMaster.cpp
)
components/gfx/Gfx.cpp
)
list(APPEND GRAPHICS_SOURCE_FILES
# FreeRTOS

View File

@ -13,7 +13,7 @@
#include "components/ble/NotificationManager.h"
#include "components/firmwarevalidator/FirmwareValidator.h"
#include "drivers/Cst816s.h"
#include "LittleVgl.h"
#include "DummyLittleVgl.h"
#include <date/date.h>
#include "displayapp/screens/Clock.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_obj.h>
#include <drivers/St7789.h>
#include "displayapp/LittleVgl.h"
#include "displayapp/DummyLittleVgl.h"
namespace Pinetime {
namespace Applications {

View File

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

View File

@ -1,7 +1,7 @@
#include <libraries/log/nrf_log.h>
#include <libraries/gpiote/app_gpiote.h>
#include <drivers/Cst816s.h>
#include "displayapp/LittleVgl.h"
#include "displayapp/DummyLittleVgl.h"
#include <hal/nrf_rtc.h>
#include "components/ble/NotificationManager.h"
#include <host/ble_gatt.h>
@ -33,7 +33,7 @@ SystemTask::SystemTask(Drivers::SpiMaster &spi, Drivers::St7789 &lcd,
Controllers::DateTime &dateTimeController,
Pinetime::Controllers::NotificationManager& notificationManager) :
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},
watchdog{}, watchdogView{watchdog}, notificationManager{notificationManager},
nimbleController(*this, bleController,dateTimeController, notificationManager, batteryController, spiNorFlash) {
@ -62,18 +62,23 @@ void SystemTask::Work() {
spiNorFlash.Wakeup();
nimbleController.Init();
nimbleController.StartAdvertising();
lcd.Init();
brightnessController.Init();
lcd.Init();
lcd.VerticalScrollDefinition(0, 240, 0);
lcd.VerticalScrollStartAddress(0);
gfx.Init();
twiMaster.Init();
touchPanel.Init();
batteryController.Init();
displayApp.reset(new Pinetime::Applications::DisplayApp(lcd, lvgl, touchPanel, batteryController, bleController,
dateTimeController, watchdogView, *this, notificationManager));
displayApp->Start();
// displayApp.reset(new Pinetime::Applications::DisplayApp(lcd, lvgl, touchPanel, batteryController, bleController,
// dateTimeController, watchdogView, *this, notificationManager));
// displayApp->Start();
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_output(15);
@ -117,8 +122,8 @@ void SystemTask::Work() {
lcd.Wakeup();
touchPanel.Wakeup();
displayApp->PushMessage(Applications::DisplayApp::Messages::GoToRunning);
displayApp->PushMessage(Applications::DisplayApp::Messages::UpdateBatteryLevel);
// displayApp->PushMessage(Applications::DisplayApp::Messages::GoToRunning);
// displayApp->PushMessage(Applications::DisplayApp::Messages::UpdateBatteryLevel);
xTimerStart(idleTimer, 0);
nimbleController.StartAdvertising();
@ -129,15 +134,15 @@ 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::DisplayApp::Messages::GoToSleep);
break;
case Messages::OnNewTime:
ReloadIdleTimer();
displayApp->PushMessage(Pinetime::Applications::DisplayApp::Messages::UpdateDateTime);
// displayApp->PushMessage(Pinetime::Applications::DisplayApp::Messages::UpdateDateTime);
break;
case Messages::OnNewNotification:
if(isSleeping && !isWakingUp) GoToRunning();
displayApp->PushMessage(Pinetime::Applications::DisplayApp::Messages::NewNotification);
// displayApp->PushMessage(Pinetime::Applications::DisplayApp::Messages::NewNotification);
break;
case Messages::BleConnected:
ReloadIdleTimer();
@ -147,7 +152,7 @@ void SystemTask::Work() {
case Messages::BleFirmwareUpdateStarted:
doNotGoToSleep = true;
if(isSleeping && !isWakingUp) GoToRunning();
displayApp->PushMessage(Pinetime::Applications::DisplayApp::Messages::BleFirmwareUpdateStarted);
// displayApp->PushMessage(Pinetime::Applications::DisplayApp::Messages::BleFirmwareUpdateStarted);
break;
case Messages::BleFirmwareUpdateFinished:
doNotGoToSleep = false;
@ -195,6 +200,25 @@ void SystemTask::Work() {
batteryController.Update();
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))
watchdog.Kick();
@ -208,7 +232,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::DisplayApp::Messages::ButtonPushed);
}
else {
if(!isWakingUp) {
@ -228,7 +252,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::DisplayApp::Messages::TouchEvent);
}
}

View File

@ -51,7 +51,8 @@ namespace Pinetime {
Pinetime::Drivers::Cst816S& touchPanel;
Pinetime::Components::LittleVgl& lvgl;
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::DateTime& dateTimeController;
QueueHandle_t systemTasksMsgQueue;
@ -62,6 +63,7 @@ namespace Pinetime {
Pinetime::Drivers::WatchdogView watchdogView;
Pinetime::Controllers::NotificationManager& notificationManager;
Pinetime::Controllers::NimbleController nimbleController;
Controllers::BrightnessController brightnessController;
static constexpr uint8_t pinSpiSck = 2;