Skip to content

Commit

Permalink
Merge branch 'InfiniTimeOrg:main' into loading-vibrations
Browse files Browse the repository at this point in the history
  • Loading branch information
minacode authored Jun 20, 2023
2 parents 9a56679 + 505520d commit 97a55d2
Show file tree
Hide file tree
Showing 25 changed files with 20 additions and 2,320 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,6 @@
[submodule "src/libs/QCBOR"]
path = src/libs/QCBOR
url = https://github.com/laurencelundblade/QCBOR.git
[submodule "src/libs/arduinoFFT"]
path = src/libs/arduinoFFT
url = https://github.com/kosme/arduinoFFT.git
6 changes: 3 additions & 3 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -672,9 +672,9 @@ set(INCLUDE_FILES
heartratetask/HeartRateTask.h
components/heartrate/Ppg.h
components/heartrate/HeartRateController.h
libs/arduinoFFT-develop/src/arduinoFFT.h
libs/arduinoFFT-develop/src/defs.h
libs/arduinoFFT-develop/src/types.h
libs/arduinoFFT/src/arduinoFFT.h
libs/arduinoFFT/src/defs.h
libs/arduinoFFT/src/types.h
components/motor/MotorController.h
buttonhandler/ButtonHandler.h
touchhandler/TouchHandler.h
Expand Down
3 changes: 2 additions & 1 deletion src/components/heartrate/Ppg.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@
#include <cstdint>
// Note: Change internal define 'sqrt_internal sqrt' to
// 'sqrt_internal sqrtf' to save ~3KB of flash.
#define sqrt_internal sqrtf
#define FFT_SPEED_OVER_PRECISION
#include "libs/arduinoFFT-develop/src/arduinoFFT.h"
#include "libs/arduinoFFT/src/arduinoFFT.h"

namespace Pinetime {
namespace Controllers {
Expand Down
3 changes: 2 additions & 1 deletion src/components/motion/MotionController.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ void MotionController::Update(int16_t x, int16_t y, int16_t z, uint32_t nbSteps)
lastTime = time;
time = xTaskGetTickCount();

lastX = this->x;
this->x = x;
lastY = this->y;
this->y = y;
Expand Down Expand Up @@ -53,7 +54,7 @@ bool MotionController::ShouldRaiseWake(bool isSleeping) {

bool MotionController::ShouldShakeWake(uint16_t thresh) {
/* Currently Polling at 10hz, If this ever goes faster scalar and EMA might need adjusting */
int32_t speed = std::abs(z + (y / 2) + (x / 4) - lastY / 2 - lastZ) / (time - lastTime) * 100;
int32_t speed = std::abs(z - lastZ + (y / 2) - (lastY / 2) + (x / 4) - (lastX / 4)) / (time - lastTime) * 100;
//(.2 * speed) + ((1 - .2) * accumulatedSpeed);
// implemented without floats as .25Alpha
accumulatedSpeed = (speed / 5) + ((accumulatedSpeed / 5) * 4);
Expand Down
1 change: 1 addition & 0 deletions src/components/motion/MotionController.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ namespace Pinetime {
TickType_t lastTime = 0;
TickType_t time = 0;

int16_t lastX = 0;
int16_t x = 0;
int16_t lastYForRaiseWake = 0;
int16_t lastY = 0;
Expand Down
14 changes: 7 additions & 7 deletions src/displayapp/screens/WatchFaceCasioStyleG7710.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,14 @@ WatchFaceCasioStyleG7710::WatchFaceCasioStyleG7710(Controllers::DateTime& dateTi
font_segment115 = lv_font_load("F:/fonts/7segments_115.bin");
}

label_battery_vallue = lv_label_create(lv_scr_act(), nullptr);
lv_obj_align(label_battery_vallue, lv_scr_act(), LV_ALIGN_IN_TOP_RIGHT, 0, 0);
lv_obj_set_style_local_text_color(label_battery_vallue, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, color_text);
lv_label_set_text_static(label_battery_vallue, "00%");
label_battery_value = lv_label_create(lv_scr_act(), nullptr);
lv_obj_align(label_battery_value, lv_scr_act(), LV_ALIGN_IN_TOP_RIGHT, 0, 0);
lv_obj_set_style_local_text_color(label_battery_value, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, color_text);
lv_label_set_text_static(label_battery_value, "00%");

batteryIcon.Create(lv_scr_act());
batteryIcon.SetColor(color_text);
lv_obj_align(batteryIcon.GetObject(), label_battery_vallue, LV_ALIGN_OUT_LEFT_MID, -5, 0);
lv_obj_align(batteryIcon.GetObject(), label_battery_value, LV_ALIGN_OUT_LEFT_MID, -5, 0);

batteryPlug = lv_label_create(lv_scr_act(), nullptr);
lv_obj_set_style_local_text_color(batteryPlug, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, color_text);
Expand Down Expand Up @@ -203,15 +203,15 @@ void WatchFaceCasioStyleG7710::Refresh() {
if (batteryPercentRemaining.IsUpdated()) {
auto batteryPercent = batteryPercentRemaining.Get();
batteryIcon.SetBatteryPercentage(batteryPercent);
lv_label_set_text_fmt(label_battery_vallue, "%d%%", batteryPercent);
lv_label_set_text_fmt(label_battery_value, "%d%%", batteryPercent);
}

bleState = bleController.IsConnected();
bleRadioEnabled = bleController.IsRadioEnabled();
if (bleState.IsUpdated() || bleRadioEnabled.IsUpdated()) {
lv_label_set_text_static(bleIcon, BleIcon::GetIcon(bleState.Get()));
}
lv_obj_realign(label_battery_vallue);
lv_obj_realign(label_battery_value);
lv_obj_realign(batteryIcon.GetObject());
lv_obj_realign(batteryPlug);
lv_obj_realign(bleIcon);
Expand Down
2 changes: 1 addition & 1 deletion src/displayapp/screens/WatchFaceCasioStyleG7710.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ namespace Pinetime {
lv_obj_t* backgroundLabel;
lv_obj_t* bleIcon;
lv_obj_t* batteryPlug;
lv_obj_t* label_battery_vallue;
lv_obj_t* label_battery_value;
lv_obj_t* heartbeatIcon;
lv_obj_t* heartbeatValue;
lv_obj_t* stepIcon;
Expand Down
1 change: 1 addition & 0 deletions src/libs/arduinoFFT
Submodule arduinoFFT added at 419d7b
3 changes: 0 additions & 3 deletions src/libs/arduinoFFT-develop/.gitignore

This file was deleted.

119 changes: 0 additions & 119 deletions src/libs/arduinoFFT-develop/Examples/FFT_01/FFT_01.ino

This file was deleted.

125 changes: 0 additions & 125 deletions src/libs/arduinoFFT-develop/Examples/FFT_02/FFT_02.ino

This file was deleted.

Loading

0 comments on commit 97a55d2

Please sign in to comment.