Compare commits
1 Commits
master
...
register_d
Author | SHA1 | Date | |
---|---|---|---|
|
0077cb7398 |
@ -309,10 +309,8 @@ sets a white background, be able to make it also flash with a red background.
|
|||||||
* Write an alarm app which set an RTC alarm to vibrate the watch.
|
* Write an alarm app which set an RTC alarm to vibrate the watch.
|
||||||
* Write a timer app with countdown and lap functionality.
|
* Write a timer app with countdown and lap functionality.
|
||||||
* Implement a battery saving mode activated on low batterie (ie <= 10 %).
|
* Implement a battery saving mode activated on low batterie (ie <= 10 %).
|
||||||
* This mode would :
|
* This mode would turn bluetooth off
|
||||||
* turn bluetooth off.
|
* This mode would set the screen brightness to 50 %
|
||||||
* set the screen brightness to 50 %.
|
|
||||||
* throttle the MCU frequency down to 80 or 40 Mhz.
|
|
||||||
|
|
||||||
|
|
||||||
## Done List :
|
## Done List :
|
||||||
|
@ -1,13 +1,3 @@
|
|||||||
/**
|
|
||||||
* @file BMP280.c
|
|
||||||
* @author Anatole SCHRAMM-HENRY
|
|
||||||
* @brief BMP280 pressure and temperature bosch sensor functions implementation source file.
|
|
||||||
* @version 0.1
|
|
||||||
* @date 2025-04-29
|
|
||||||
*
|
|
||||||
* @copyright MIT
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include "i2c.h"
|
#include "i2c.h"
|
||||||
#include "BMP280.h"
|
#include "BMP280.h"
|
||||||
|
@ -1,13 +1,3 @@
|
|||||||
/**
|
|
||||||
* @file BMP280.h
|
|
||||||
* @author Anatole SCHRAMM-HENRY
|
|
||||||
* @brief BMP280 pressure and temperature bosch sensor functions API header file.
|
|
||||||
* @version 0.1
|
|
||||||
* @date 2025-04-29
|
|
||||||
*
|
|
||||||
* @copyright MIT
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef BMP280_H
|
#ifndef BMP280_H
|
||||||
#define BMP280_H
|
#define BMP280_H
|
||||||
|
|
||||||
@ -102,7 +92,7 @@ float BMP280_get_temperature(void);
|
|||||||
/**
|
/**
|
||||||
* @brief Returns the previously sampled pressure in Pa.
|
* @brief Returns the previously sampled pressure in Pa.
|
||||||
*
|
*
|
||||||
* @param temperature the address of a float which will contain the measured temperature in °C. If not needed, can be NULL.
|
* @param temperature the address of a float which will contain the measured temperature. If not needed, can be NULL.
|
||||||
* @return float the value of the pressure in Pa
|
* @return float the value of the pressure in Pa
|
||||||
*/
|
*/
|
||||||
float BMP280_get_pressure(float * const temperature);
|
float BMP280_get_pressure(float * const temperature);
|
||||||
|
@ -1,13 +1,3 @@
|
|||||||
/**
|
|
||||||
* @file QMC5883L.c
|
|
||||||
* @author Anatole SCHRAMM-HENRY
|
|
||||||
* @brief QMC5883L magnetometer functions implementation source file.
|
|
||||||
* @version 0.1
|
|
||||||
* @date 2025-03-17
|
|
||||||
*
|
|
||||||
* @copyright MIT
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include "i2c.h"
|
#include "i2c.h"
|
||||||
#include "QMC5883L.h"
|
#include "QMC5883L.h"
|
||||||
@ -55,17 +45,18 @@ bool QMC5883L_software_reset(void)
|
|||||||
|
|
||||||
float QMC5883L_get_temperature(void)
|
float QMC5883L_get_temperature(void)
|
||||||
{
|
{
|
||||||
uint8_t data[2];
|
uint8_t data;
|
||||||
int16_t raw_temp;
|
int16_t raw_temp;
|
||||||
float temperature = 0.0F;
|
|
||||||
|
|
||||||
if(i2c_read(QMC5883L_I2C_ADDR, QMC5883L_TEMP_LSB_REG, data, sizeof data))
|
i2c_read_reg(QMC5883L_I2C_ADDR, QMC5883L_TEMP_MSB_REG, &data);
|
||||||
{
|
|
||||||
raw_temp = (data[1] << 8) | data[0];
|
|
||||||
temperature = (float)raw_temp / 100.0F + _calibration_data.temperature_offset;
|
|
||||||
}
|
|
||||||
|
|
||||||
return temperature;
|
raw_temp = data << 8;
|
||||||
|
|
||||||
|
i2c_read_reg(QMC5883L_I2C_ADDR, QMC5883L_TEMP_LSB_REG, &data);
|
||||||
|
|
||||||
|
raw_temp |= data;
|
||||||
|
|
||||||
|
return (float) raw_temp / 100.0 + _calibration_data.temperature_offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QMC5883L_is_data_available(void)
|
bool QMC5883L_is_data_available(void)
|
||||||
@ -105,10 +96,15 @@ QMC5883L_MData_t QMC5883L_get_MFields_raw(void)
|
|||||||
|
|
||||||
QMC5883L_MData_calibrated_t QMC5883L_get_MFields_calibrated(void)
|
QMC5883L_MData_calibrated_t QMC5883L_get_MFields_calibrated(void)
|
||||||
{
|
{
|
||||||
/* Read the raw magnetic field values first */
|
uint8_t data[6];
|
||||||
QMC5883L_MData_t raw_data = QMC5883L_get_MFields_raw();
|
QMC5883L_MData_calibrated_t Mdata = {.MFieldX = -1, .MFieldY = -1, .MFieldZ = -1};
|
||||||
|
|
||||||
QMC5883L_MData_calibrated_t Mdata = {.MFieldX = raw_data.MFieldX, .MFieldY = raw_data.MFieldY, .MFieldZ = raw_data.MFieldZ};
|
if(i2c_read(QMC5883L_I2C_ADDR, QMC5883L_DATA_X_LSB_REG, data, sizeof data))
|
||||||
|
{
|
||||||
|
Mdata.MFieldX = (data[1] << 8) | data[0];
|
||||||
|
Mdata.MFieldY = (data[3] << 8) | data[2];
|
||||||
|
Mdata.MFieldZ = (data[5] << 8) | data[4];
|
||||||
|
}
|
||||||
|
|
||||||
int x_offset = (_calibration_data.x_min + _calibration_data.x_max) / 2;
|
int x_offset = (_calibration_data.x_min + _calibration_data.x_max) / 2;
|
||||||
int y_offset = (_calibration_data.y_min + _calibration_data.y_max) / 2;
|
int y_offset = (_calibration_data.y_min + _calibration_data.y_max) / 2;
|
||||||
|
@ -1,13 +1,3 @@
|
|||||||
/**
|
|
||||||
* @file QMC5883L.h
|
|
||||||
* @author Anatole SCHRAMM-HENRY
|
|
||||||
* @brief QMC5883L magnetometer functions API header file.
|
|
||||||
* @version 0.1
|
|
||||||
* @date 2025-03-17
|
|
||||||
*
|
|
||||||
* @copyright MIT
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef QMC5883L_H
|
#ifndef QMC5883L_H
|
||||||
#define QMC5883L_H
|
#define QMC5883L_H
|
||||||
|
|
||||||
|
@ -1,14 +1,3 @@
|
|||||||
/**
|
|
||||||
* @file watch_peripherals.c
|
|
||||||
* @author Anatole SCHRAMM-HENRY
|
|
||||||
* @brief Defines various functions to interract with some of the watch's
|
|
||||||
* peripherals like : reading the battery voltage, using the vibration motor etc.
|
|
||||||
* @version 0.1
|
|
||||||
* @date 2025-04-29
|
|
||||||
*
|
|
||||||
* @copyright MIT
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "watch_peripherals.h"
|
#include "watch_peripherals.h"
|
||||||
#include "app_config.h"
|
#include "app_config.h"
|
||||||
#include "app_log.h"
|
#include "app_log.h"
|
||||||
@ -24,7 +13,6 @@
|
|||||||
#include "CST816D.h"
|
#include "CST816D.h"
|
||||||
#include "app_utils.h"
|
#include "app_utils.h"
|
||||||
#include "watch_settings.h"
|
#include "watch_settings.h"
|
||||||
#include "FreeRTOS.h"
|
|
||||||
|
|
||||||
#define INTERRUPT_POLICY (0)
|
#define INTERRUPT_POLICY (0)
|
||||||
#define POLL_POLICY (1)
|
#define POLL_POLICY (1)
|
||||||
@ -58,10 +46,8 @@ static battery_controller_status_e _battery_fsm = BATTERY_CONTROLLER_STATUS_DISC
|
|||||||
static BatteryControllerStatusChangeCb_t _BatteryControllerStatusChangeCb = NULL;
|
static BatteryControllerStatusChangeCb_t _BatteryControllerStatusChangeCb = NULL;
|
||||||
|
|
||||||
/* Wakeup source boolean */
|
/* Wakeup source boolean */
|
||||||
static struct
|
static bool _wakeup_is_io = false;
|
||||||
{
|
static bool _wakeup_is_timer = false;
|
||||||
bool is_io:1, is_timer:1, is_rtc_alarm:1;
|
|
||||||
} _wakeup_src = {false, false, false};
|
|
||||||
|
|
||||||
/* BMA456 structure */
|
/* BMA456 structure */
|
||||||
static struct
|
static struct
|
||||||
@ -201,25 +187,17 @@ typedef enum wakeup_source
|
|||||||
{
|
{
|
||||||
WAKEUP_SOURCE_IO = 0,
|
WAKEUP_SOURCE_IO = 0,
|
||||||
WAKEUP_SOURCE_TIMER,
|
WAKEUP_SOURCE_TIMER,
|
||||||
WAKEUP_SOURCE_RTC_ALARM,
|
|
||||||
} wakeup_source_e;
|
} wakeup_source_e;
|
||||||
|
|
||||||
static void pmu_wakeup_source_irq_cb(void *arg)
|
static void pmu_wakeup_source_irq_cb(void *arg)
|
||||||
{
|
{
|
||||||
wakeup_source_e wakeup_source = (wakeup_source_e)arg;
|
wakeup_source_e wakeup_source = (wakeup_source_e)arg;
|
||||||
|
|
||||||
switch(wakeup_source)
|
if(wakeup_source == WAKEUP_SOURCE_IO)
|
||||||
{
|
_wakeup_is_io = true;
|
||||||
case WAKEUP_SOURCE_IO:
|
|
||||||
_wakeup_src.is_io = true;
|
if(wakeup_source == WAKEUP_SOURCE_TIMER)
|
||||||
break;
|
_wakeup_is_timer = true;
|
||||||
case WAKEUP_SOURCE_TIMER:
|
|
||||||
_wakeup_src.is_timer = true;
|
|
||||||
break;
|
|
||||||
case WAKEUP_SOURCE_RTC_ALARM:
|
|
||||||
_wakeup_src.is_rtc_alarm = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void watch_peripherals_io_init(void)
|
static void watch_peripherals_io_init(void)
|
||||||
@ -248,7 +226,6 @@ static void watch_peripherals_io_init(void)
|
|||||||
/* We register the IRQs needed to determine the watch wake up source/reason */
|
/* We register the IRQs needed to determine the watch wake up source/reason */
|
||||||
tls_pmu_gpio_isr_register(&(pmu_wakeup_source_irq_cb), (void *)WAKEUP_SOURCE_IO);
|
tls_pmu_gpio_isr_register(&(pmu_wakeup_source_irq_cb), (void *)WAKEUP_SOURCE_IO);
|
||||||
tls_pmu_timer0_isr_register(&(pmu_wakeup_source_irq_cb), (void *)WAKEUP_SOURCE_TIMER);
|
tls_pmu_timer0_isr_register(&(pmu_wakeup_source_irq_cb), (void *)WAKEUP_SOURCE_TIMER);
|
||||||
tls_rtc_isr_register(&(pmu_wakeup_source_irq_cb), (void *)WAKEUP_SOURCE_RTC_ALARM);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef CASE_RETURN_STR
|
#ifndef CASE_RETURN_STR
|
||||||
@ -487,9 +464,9 @@ void watch_peripherals_set_orientation(LCDOrientation_e orientation)
|
|||||||
|
|
||||||
bool watch_peripherals_wakeup_source_is_user(void)
|
bool watch_peripherals_wakeup_source_is_user(void)
|
||||||
{
|
{
|
||||||
if(_wakeup_src.is_io)
|
if(_wakeup_is_io)
|
||||||
{
|
{
|
||||||
_wakeup_src.is_io = false;
|
_wakeup_is_io = false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@ -497,19 +474,9 @@ bool watch_peripherals_wakeup_source_is_user(void)
|
|||||||
|
|
||||||
bool watch_peripherals_wakeup_source_is_timer(void)
|
bool watch_peripherals_wakeup_source_is_timer(void)
|
||||||
{
|
{
|
||||||
if(_wakeup_src.is_timer)
|
if(_wakeup_is_timer)
|
||||||
{
|
{
|
||||||
_wakeup_src.is_timer = false;
|
_wakeup_is_timer = false;
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool watch_peripherals_wakeup_source_is_rtc_alarm(void)
|
|
||||||
{
|
|
||||||
if(_wakeup_src.is_rtc_alarm)
|
|
||||||
{
|
|
||||||
_wakeup_src.is_rtc_alarm = false;
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@ -572,12 +539,9 @@ uint16_t watch_peripherals_magnetometer_azimuth_read(bool *is_data_available)
|
|||||||
return QMC5883L_get_azimuth(MData);
|
return QMC5883L_get_azimuth(MData);
|
||||||
}
|
}
|
||||||
|
|
||||||
watch_peripherals_axes_t watch_peripherals_magnetometer_raw_data_read(void)
|
QMC5883L_MData_t watch_peripherals_magnetometer_raw_data_read(void)
|
||||||
{
|
{
|
||||||
QMC5883L_MData_t MData = QMC5883L_get_MFields_raw();
|
return QMC5883L_get_MFields_raw();
|
||||||
|
|
||||||
watch_peripherals_axes_t axes = {.mag.x = MData.MFieldX, .mag.y = MData.MFieldY, .mag.z = MData.MFieldZ};
|
|
||||||
return axes;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
float watch_peripherals_magnetometer_temperature_read()
|
float watch_peripherals_magnetometer_temperature_read()
|
||||||
@ -627,8 +591,7 @@ bool watch_peripherals_pressure_sensor_select_profile(watch_peripherals_pressure
|
|||||||
float watch_peripherals_pressure_sensor_get_pressure(float * const temperature)
|
float watch_peripherals_pressure_sensor_get_pressure(float * const temperature)
|
||||||
{
|
{
|
||||||
BMP280_trigger_measurement();
|
BMP280_trigger_measurement();
|
||||||
/* Not great but needed to avoid an I2C wait ack err */
|
|
||||||
tls_os_time_delay(pdMS_TO_TICKS(2));
|
|
||||||
while(BMP280_is_measuring());
|
while(BMP280_is_measuring());
|
||||||
|
|
||||||
return BMP280_get_pressure(temperature);
|
return BMP280_get_pressure(temperature);
|
||||||
@ -823,41 +786,6 @@ bool watch_peripherals_accelerometer_step_count_reset(void)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool watch_peripherals_accelerometer_temperature_read(float *temperature)
|
|
||||||
{
|
|
||||||
if(!temperature) return false;
|
|
||||||
|
|
||||||
int32_t raw_temperature;
|
|
||||||
if(bma4_get_temperature(&raw_temperature, BMA4_DEG, &_bma456.bma) != BMA4_OK)
|
|
||||||
{
|
|
||||||
APP_LOG_ERROR("Failed to read temperature");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
*temperature = raw_temperature / 1000.0F;
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool watch_peripherals_accelerometer_accel_read(watch_peripherals_axes_t *axes)
|
|
||||||
{
|
|
||||||
if(!axes)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
struct bma4_accel acceleration = { .x = -1, .y = -1, .z = -1};
|
|
||||||
if(bma4_read_accel_xyz(&acceleration, &_bma456.bma) != BMA4_OK)
|
|
||||||
{
|
|
||||||
APP_LOG_ERROR("Failed to read the acceleration");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
axes->accel.x = acceleration.x;
|
|
||||||
axes->accel.y = acceleration.y;
|
|
||||||
axes->accel.z = acceleration.z;
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void watch_peripherals_watch_sleep(void)
|
void watch_peripherals_watch_sleep(void)
|
||||||
{
|
{
|
||||||
extern LCDConfig_t LCDConfig;
|
extern LCDConfig_t LCDConfig;
|
||||||
|
@ -1,14 +1,7 @@
|
|||||||
/**
|
/**
|
||||||
* @file watch_peripherals.h
|
* Declares various functions to interract with some of the watch's
|
||||||
* @author Anatole SCHRAMM-HENRY
|
|
||||||
* @brief Declares various functions to interract with some of the watch's
|
|
||||||
* peripherals like : reading the battery voltage, using the vibration motor etc.
|
* peripherals like : reading the battery voltage, using the vibration motor etc.
|
||||||
* @version 0.1
|
|
||||||
* @date 2025-04-29
|
|
||||||
*
|
|
||||||
* @copyright MIT
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef WATCH_PERIPHERALS_H
|
#ifndef WATCH_PERIPHERALS_H
|
||||||
#define WATCH_PERIPHERALS_H
|
#define WATCH_PERIPHERALS_H
|
||||||
|
|
||||||
@ -32,23 +25,6 @@ typedef enum battery_controller_status
|
|||||||
BATTERY_CONTROLLER_STATUS_ERROR
|
BATTERY_CONTROLLER_STATUS_ERROR
|
||||||
} battery_controller_status_e;
|
} battery_controller_status_e;
|
||||||
|
|
||||||
typedef union watch_peripherals_axes
|
|
||||||
{
|
|
||||||
struct
|
|
||||||
{
|
|
||||||
int16_t x;
|
|
||||||
int16_t y;
|
|
||||||
int16_t z;
|
|
||||||
} accel;
|
|
||||||
|
|
||||||
struct
|
|
||||||
{
|
|
||||||
int16_t x;
|
|
||||||
int16_t y;
|
|
||||||
int16_t z;
|
|
||||||
} mag;
|
|
||||||
} watch_peripherals_axes_t;
|
|
||||||
|
|
||||||
typedef void (*BatteryControllerStatusChangeCb_t)(battery_controller_status_e old, battery_controller_status_e new);
|
typedef void (*BatteryControllerStatusChangeCb_t)(battery_controller_status_e old, battery_controller_status_e new);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -166,7 +142,6 @@ void watch_peripherals_set_orientation(LCDOrientation_e orientation);
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Check if the watch woke up because of the user(trigger on the wakeup pin : wrist tilt or touch screen).
|
* @brief Check if the watch woke up because of the user(trigger on the wakeup pin : wrist tilt or touch screen).
|
||||||
* Calling this function clears the wakeup source flag.
|
|
||||||
*
|
*
|
||||||
* @return true if the source of the wakeup is the user
|
* @return true if the source of the wakeup is the user
|
||||||
* @return false otherwise
|
* @return false otherwise
|
||||||
@ -175,22 +150,12 @@ bool watch_peripherals_wakeup_source_is_user(void);
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Check if the watch woke up because of a timed event (timer 0 of the PMU module).
|
* @brief Check if the watch woke up because of a timed event (timer 0 of the PMU module).
|
||||||
* Calling this function clears the wakeup source flag.
|
|
||||||
*
|
*
|
||||||
* @return true if the source of the wake up is the timer 0
|
* @return true if the source of the wake up is the timer 0
|
||||||
* @return false otherwise
|
* @return false otherwise
|
||||||
*/
|
*/
|
||||||
bool watch_peripherals_wakeup_source_is_timer(void);
|
bool watch_peripherals_wakeup_source_is_timer(void);
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Check if the watch woke up because of a RTC alarm event.
|
|
||||||
* Calling this function clears the wakeup source flag.
|
|
||||||
*
|
|
||||||
* @return true if the source of the wake up is the RTC alarm
|
|
||||||
* @return false otherwise
|
|
||||||
*/
|
|
||||||
bool watch_peripherals_wakeup_source_is_rtc_alarm(void);
|
|
||||||
|
|
||||||
bool watch_peripherals_magnetometer_init(void);
|
bool watch_peripherals_magnetometer_init(void);
|
||||||
|
|
||||||
void watch_peripherals_magnetometer_calibration_data_set(
|
void watch_peripherals_magnetometer_calibration_data_set(
|
||||||
@ -201,7 +166,7 @@ void watch_peripherals_magnetometer_calibration_data_set(
|
|||||||
|
|
||||||
uint16_t watch_peripherals_magnetometer_azimuth_read(bool *is_data_available);
|
uint16_t watch_peripherals_magnetometer_azimuth_read(bool *is_data_available);
|
||||||
|
|
||||||
watch_peripherals_axes_t watch_peripherals_magnetometer_raw_data_read(void);
|
QMC5883L_MData_t watch_peripherals_magnetometer_raw_data_read(void);
|
||||||
|
|
||||||
float watch_peripherals_magnetometer_temperature_read();
|
float watch_peripherals_magnetometer_temperature_read();
|
||||||
|
|
||||||
@ -217,12 +182,6 @@ typedef enum watch_peripherals_pressure_sensor_profile
|
|||||||
|
|
||||||
bool watch_peripherals_pressure_sensor_select_profile(watch_peripherals_pressure_sensor_profile_e profile);
|
bool watch_peripherals_pressure_sensor_select_profile(watch_peripherals_pressure_sensor_profile_e profile);
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Returns the measured pressure by the sensor in Pa and temperature in °C.
|
|
||||||
*
|
|
||||||
* @param temperature the address of a float which will contain the measured temperature in °C. If not needed, can be NULL.
|
|
||||||
* @return float the value of the pressure in Pa
|
|
||||||
*/
|
|
||||||
float watch_peripherals_pressure_sensor_get_pressure(float * const temperature);
|
float watch_peripherals_pressure_sensor_get_pressure(float * const temperature);
|
||||||
|
|
||||||
bool watch_peripherals_accelerometer_init(void);
|
bool watch_peripherals_accelerometer_init(void);
|
||||||
@ -237,24 +196,6 @@ bool watch_peripherals_accelerometer_step_count_read(uint32_t *step_count);
|
|||||||
|
|
||||||
bool watch_peripherals_accelerometer_step_count_reset(void);
|
bool watch_peripherals_accelerometer_step_count_reset(void);
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Reads the accelerometer's temperature in °C.
|
|
||||||
*
|
|
||||||
* @param temperature the address of a float which will contain the measured temperature in °C.
|
|
||||||
* @return true if the temperature could be retrieved
|
|
||||||
* @return false otherwise
|
|
||||||
*/
|
|
||||||
bool watch_peripherals_accelerometer_temperature_read(float *temperature);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Reads the accelerometer's acceleration on the X,Y and Z axes.
|
|
||||||
*
|
|
||||||
* @param axes the address of an union of type @ref watch_peripherals_axes_t used to store the values.
|
|
||||||
* @return true if the acceleration could be retrieved
|
|
||||||
* @return false otherwise
|
|
||||||
*/
|
|
||||||
bool watch_peripherals_accelerometer_accel_read(watch_peripherals_axes_t *axes);
|
|
||||||
|
|
||||||
void watch_peripherals_watch_sleep(void);
|
void watch_peripherals_watch_sleep(void);
|
||||||
|
|
||||||
#endif //WATCH_PERIPHERALS_H
|
#endif //WATCH_PERIPHERALS_H
|
@ -2,6 +2,7 @@
|
|||||||
#include "app_utils.h"
|
#include "app_utils.h"
|
||||||
#include "app_log.h"
|
#include "app_log.h"
|
||||||
#include "wm_crypto_hard.h"
|
#include "wm_crypto_hard.h"
|
||||||
|
#include "wm_regs.h"
|
||||||
|
|
||||||
static uint32_t _elapsed_ms = 0;
|
static uint32_t _elapsed_ms = 0;
|
||||||
|
|
||||||
@ -91,3 +92,21 @@ uint32_t random_gen_6_digit(void)
|
|||||||
|
|
||||||
return output_num;
|
return output_num;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void print_reg_full(const char * reg_name, unsigned int addr, uint8_t size)
|
||||||
|
{
|
||||||
|
unsigned int *reg_addr = (unsigned int *)addr;
|
||||||
|
printf("%s :"NEW_LINE, reg_name);
|
||||||
|
for(uint8_t i = 0; i < size; i++)
|
||||||
|
{
|
||||||
|
printf("[0x%08X] => 0x%08X"NEW_LINE, (unsigned int)reg_addr, tls_reg_read32((unsigned int)reg_addr));
|
||||||
|
reg_addr++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void register_dump(void)
|
||||||
|
{
|
||||||
|
print_reg_full("PMU REG", HR_PMU_BASE_ADDR, 64);
|
||||||
|
print_reg_full("CLK REG", HR_CLK_BASE_ADDR, 64);
|
||||||
|
print_reg_full("BT MODEM", 0x40012200,128);
|
||||||
|
}
|
||||||
|
@ -3,17 +3,6 @@
|
|||||||
|
|
||||||
#include "wm_include.h"
|
#include "wm_include.h"
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Macro used to stringify the value of a define.
|
|
||||||
*/
|
|
||||||
#define STRINGIFY_VALUE(x) STRINGIFY(x)
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Macro used to stringify a define.
|
|
||||||
*/
|
|
||||||
#define STRINGIFY(x) #x
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Wait for the specified time in micro seconds. This is a blocking function !
|
* @brief Wait for the specified time in micro seconds. This is a blocking function !
|
||||||
*
|
*
|
||||||
@ -49,4 +38,10 @@ uint32_t elapsed_ms(void);
|
|||||||
*/
|
*/
|
||||||
uint32_t random_gen_6_digit(void);
|
uint32_t random_gen_6_digit(void);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Debug function used to dump register values
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
void register_dump(void);
|
||||||
|
|
||||||
#endif //APP_UTILS_H
|
#endif //APP_UTILS_H
|
@ -75,9 +75,6 @@ bool ble_modem_off(void)
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// Don't forget to set the rf bt mode to it's default config
|
|
||||||
tls_rf_bt_mode(false);
|
|
||||||
|
|
||||||
status = tls_bt_deinit();
|
status = tls_bt_deinit();
|
||||||
|
|
||||||
if((status != BLE_HS_ENOERR) && (status != BLE_HS_EALREADY)) {
|
if((status != BLE_HS_ENOERR) && (status != BLE_HS_EALREADY)) {
|
||||||
@ -87,7 +84,7 @@ bool ble_modem_off(void)
|
|||||||
if(status != BLE_HS_EALREADY)
|
if(status != BLE_HS_EALREADY)
|
||||||
{
|
{
|
||||||
//Starting a wifi scan really stops the BT modem ?? Why ? I don't know
|
//Starting a wifi scan really stops the BT modem ?? Why ? I don't know
|
||||||
tls_wifi_passive_scan();
|
tls_wifi_scan();
|
||||||
}
|
}
|
||||||
|
|
||||||
return ((status == BLE_HS_ENOERR || status == BLE_HS_EALREADY) && serviceStopSuccess) ? true : false;
|
return ((status == BLE_HS_ENOERR || status == BLE_HS_EALREADY) && serviceStopSuccess) ? true : false;
|
||||||
|
@ -36,22 +36,12 @@
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Reworked the altimeter app to display the time and date on the altitude screen,
|
* @brief Reworked the altimeter app to display the time and date on the altitude screen,
|
||||||
* Added a PMU related function to start the 32k OSC calibration routine.
|
* added a PMU related function to start the 32k OSC calibration routine.
|
||||||
* Added 'û' and 'Û' characters to the LVGL font.
|
* Added 'û' and 'Û' characters to the LVGL font.
|
||||||
* Other minor changes.
|
* Other minor changes.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
//#define FIRMWARE_VERSION "0.0.6"
|
#define FIRMWARE_VERSION "0.0.6"
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Improved BLE start and stop handling (unidentified current leak of 1mA when BLE is turned off fixed)
|
|
||||||
* Added a 3 second timer to show the watch minute and hour hands again after the user decided to hide them.
|
|
||||||
* Reworked the settings screen : added a new sensor category displaying sensor data.
|
|
||||||
* Reworked the settings screen : removed displayed sensor data in the about section and added components versions.
|
|
||||||
* Other minor improvements : some i2c driver enhancement.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
#define FIRMWARE_VERSION "0.0.7"
|
|
||||||
|
|
||||||
|
|
||||||
#define FIRMWARE_COMPILATION_TIME_DATE (__TIME__" "__DATE__)
|
#define FIRMWARE_COMPILATION_TIME_DATE (__TIME__" "__DATE__)
|
||||||
|
@ -6,8 +6,6 @@
|
|||||||
#include "lv_port_indev.h"
|
#include "lv_port_indev.h"
|
||||||
#include "lv_port_tick.h"
|
#include "lv_port_tick.h"
|
||||||
#include "FreeRTOS.h"
|
#include "FreeRTOS.h"
|
||||||
/* Needed to retrieve FreeRTOS version */
|
|
||||||
#include "task.h"
|
|
||||||
#include "wm_include.h"
|
#include "wm_include.h"
|
||||||
#include "lcd.h"
|
#include "lcd.h"
|
||||||
#include "watch_face.h"
|
#include "watch_face.h"
|
||||||
@ -331,6 +329,7 @@ static void setBLEEnabledCb(bool *enabled, SettingMode_e mode)
|
|||||||
music_player_screen_notify_BLE_connection_state(&musicPlayerScreen, false);
|
music_player_screen_notify_BLE_connection_state(&musicPlayerScreen, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
register_dump();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -381,74 +380,20 @@ static void getBatteryVoltageCb(uint16_t *battery_voltage)
|
|||||||
|
|
||||||
static void getMagnetometerRawDataCb(int16_t *field_x, int16_t *field_y, int16_t *field_z, float *temperature)
|
static void getMagnetometerRawDataCb(int16_t *field_x, int16_t *field_y, int16_t *field_z, float *temperature)
|
||||||
{
|
{
|
||||||
if(field_x && field_y && field_z)
|
QMC5883L_MData_t raw_data = watch_peripherals_magnetometer_raw_data_read();
|
||||||
{
|
*field_x = raw_data.MFieldX;
|
||||||
watch_peripherals_axes_t axes = watch_peripherals_magnetometer_raw_data_read();
|
*field_y = raw_data.MFieldY;
|
||||||
*field_x = axes.mag.x;
|
*field_z = raw_data.MFieldZ;
|
||||||
*field_y = axes.mag.y;
|
|
||||||
*field_z = axes.mag.z;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(temperature)
|
|
||||||
*temperature = watch_peripherals_magnetometer_temperature_read();
|
*temperature = watch_peripherals_magnetometer_temperature_read();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void getAccelerometerRawDataCb(int16_t *accel_x, int16_t *accel_y, int16_t *accel_z, float *temperature, uint32_t *step_count)
|
|
||||||
{
|
|
||||||
|
|
||||||
if(accel_x && accel_y && accel_z)
|
|
||||||
{
|
|
||||||
watch_peripherals_axes_t axes;
|
|
||||||
if(!watch_peripherals_accelerometer_accel_read(&axes))
|
|
||||||
{
|
|
||||||
APP_LOG_DEBUG("Failed to read accelerations");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
*accel_x = axes.accel.x;
|
|
||||||
*accel_y = axes.accel.y;
|
|
||||||
*accel_z = axes.accel.z;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(temperature)
|
|
||||||
{
|
|
||||||
if(!watch_peripherals_accelerometer_temperature_read(temperature))
|
|
||||||
{
|
|
||||||
APP_LOG_DEBUG("Failed to read accelerometer's temperature");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(step_count)
|
|
||||||
{
|
|
||||||
if(!watch_peripherals_accelerometer_step_count_read(step_count))
|
|
||||||
{
|
|
||||||
APP_LOG_DEBUG("Failed to read step counts");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void getBMP280DataCb(float *temperature, float *pressure)
|
static void getBMP280DataCb(float *temperature, float *pressure)
|
||||||
{
|
{
|
||||||
/* We want hPa's */
|
/* We want hPa's */
|
||||||
*pressure = watch_peripherals_pressure_sensor_get_pressure(temperature) / 100.0;
|
*pressure = watch_peripherals_pressure_sensor_get_pressure(temperature) / 100.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void getComponentVersionCb(const char **version, ComponentVersion_e component)
|
|
||||||
{
|
|
||||||
switch(component)
|
|
||||||
{
|
|
||||||
case COMPONENT_FREERTOS:
|
|
||||||
*version = (const char *)STRINGIFY_VALUE(tskKERNEL_VERSION_MAJOR)"."STRINGIFY_VALUE(tskKERNEL_VERSION_MINOR)"."STRINGIFY_VALUE(tskKERNEL_VERSION_BUILD);
|
|
||||||
break;
|
|
||||||
case COMPONENT_LVGL:
|
|
||||||
*version = (const char *)STRINGIFY_VALUE(LVGL_VERSION_MAJOR)"."STRINGIFY_VALUE(LVGL_VERSION_MINOR)"."STRINGIFY_VALUE(LVGL_VERSION_PATCH);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void saveSettingsToFlashCb(void)
|
static void saveSettingsToFlashCb(void)
|
||||||
{
|
{
|
||||||
// Only enable the settings save feature if we compile in SMART_WATCH_PCB_RELEASE mode
|
// Only enable the settings save feature if we compile in SMART_WATCH_PCB_RELEASE mode
|
||||||
@ -507,9 +452,7 @@ SettingsScreenAPIInterface_t settingsScreenAPIInterface =
|
|||||||
.getBLEDevicePairingKeyCb = &(getBLEDevicePairingKeyCb),
|
.getBLEDevicePairingKeyCb = &(getBLEDevicePairingKeyCb),
|
||||||
.getBatteryVoltageCb = &(getBatteryVoltageCb),
|
.getBatteryVoltageCb = &(getBatteryVoltageCb),
|
||||||
.getMagnetometerRawDataCb = &(getMagnetometerRawDataCb),
|
.getMagnetometerRawDataCb = &(getMagnetometerRawDataCb),
|
||||||
.getAccelerometerRawDataCb = &(getAccelerometerRawDataCb),
|
|
||||||
.getBMP280DataCb = &(getBMP280DataCb),
|
.getBMP280DataCb = &(getBMP280DataCb),
|
||||||
.getComponentVersionCb = &(getComponentVersionCb),
|
|
||||||
.saveSettingsCb = &(saveSettingsToFlashCb),
|
.saveSettingsCb = &(saveSettingsToFlashCb),
|
||||||
.factoryResetCb = &(performFactoryResetCb),
|
.factoryResetCb = &(performFactoryResetCb),
|
||||||
};
|
};
|
||||||
@ -690,13 +633,13 @@ static void settings_screen_on_state_change_cb(SettingsScreenState_e settingsScr
|
|||||||
switch(settingsScreenState)
|
switch(settingsScreenState)
|
||||||
{
|
{
|
||||||
case SETTINGS_SCREEN_STATE_OPENED:
|
case SETTINGS_SCREEN_STATE_OPENED:
|
||||||
if(settingsScreenCategory == SETTINGS_SCREEN_CATEGORY_SENSORS)
|
if(settingsScreenCategory == SETTINGS_SCREEN_CATEGORY_ABOUT)
|
||||||
{
|
{
|
||||||
watch_peripherals_magnetometer_power_mode_set(QMC5883L_Mode_Control_Continuous);
|
watch_peripherals_magnetometer_power_mode_set(QMC5883L_Mode_Control_Continuous);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case SETTINGS_SCREEN_STATE_CLOSED:
|
case SETTINGS_SCREEN_STATE_CLOSED:
|
||||||
if(settingsScreenCategory == SETTINGS_SCREEN_CATEGORY_SENSORS)
|
if(settingsScreenCategory == SETTINGS_SCREEN_CATEGORY_ABOUT)
|
||||||
{
|
{
|
||||||
watch_peripherals_magnetometer_power_mode_set(QMC5883L_Mode_Control_Standby);
|
watch_peripherals_magnetometer_power_mode_set(QMC5883L_Mode_Control_Standby);
|
||||||
}
|
}
|
||||||
@ -875,8 +818,7 @@ void gfx_task(void *param)
|
|||||||
watch_face_register_step_counter_indicator_cb(&watchFace, &(step_count_cb));
|
watch_face_register_step_counter_indicator_cb(&watchFace, &(step_count_cb));
|
||||||
watch_face_create(&watchFace);
|
watch_face_create(&watchFace);
|
||||||
|
|
||||||
/* Using this function to load the first screen allows to free the default screen obj */
|
lv_scr_load(watchFace.display);
|
||||||
lv_scr_load_anim(watchFace.display, LV_SCR_LOAD_ANIM_NONE, 0U, 0U, true);
|
|
||||||
|
|
||||||
//QMC5883L_set_calibration_data(-900, 2500, -1400, 1400, 2300, 7500, 0.0);
|
//QMC5883L_set_calibration_data(-900, 2500, -1400, 1400, 2300, 7500, 0.0);
|
||||||
|
|
||||||
@ -896,6 +838,8 @@ void gfx_task(void *param)
|
|||||||
uint32_t ble_info_update_ms = 0;
|
uint32_t ble_info_update_ms = 0;
|
||||||
uint32_t main_data_update = 0;
|
uint32_t main_data_update = 0;
|
||||||
|
|
||||||
|
register_dump();
|
||||||
|
|
||||||
for(;;)
|
for(;;)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -6,31 +6,19 @@
|
|||||||
#include "translation.h"
|
#include "translation.h"
|
||||||
#include "firmware_version.h"
|
#include "firmware_version.h"
|
||||||
|
|
||||||
/**
|
static const char *day_options = "01\n02\n03\n04\n05\n06\n07\n08\n09\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n21\n22\n23\n24\n25\n26\n27\n28\n29\n30\n31";
|
||||||
* @brief Defines the visual spacing between lines of setting members in a category.
|
static const char *month_options = "01\n02\n03\n04\n05\n06\n07\n08\n09\n10\n11\n12";
|
||||||
*/
|
static const char *year_options = "22\n23\n24\n25\n26\n27\n28\n29\n30\n31\n32\n33\n34\n35\n36\n37\n38\n39\n40";
|
||||||
#define SETTINGS_SCREEN_CATEGORY_SPACING_INNER (3)
|
static const char *hour_options = "00\n01\n02\n03\n04\n05\n06\n07\n08\n09\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n21\n22\n23";
|
||||||
|
static const char *second_minute_options = "00\n01\n02\n03\n04\n05\n06\n07\n08\n09\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n21\n22\n23\n24\n25\n26\n27\n28\n29\n30\n31\n32\n33\n34\n35\n36\n37\n38\n39\n40\n41\n42\n43\n44\n45\n46\n47\n48\n49\n50\n51\n52\n53\n54\n55\n56\n57\n58\n59";
|
||||||
|
static const char *date_format = "dd/mm/yyyy\ndd/mm/yy\nyyyy/mm/dd\nyy/mm/dd";
|
||||||
|
|
||||||
/**
|
static const char *timeout_options = "Off\n5 seconds\n10 seconds\n15 seconds\n20 seconds\n25 seconds\n30 seconds\n35 seconds\n40 seconds\n45 seconds\n50 seconds\n55 seconds\n60 seconds";
|
||||||
* @brief Defines the visual spacing between different setting categories.
|
static const char *orientation_format = "Default\n90°\n180°\n270°";
|
||||||
*/
|
static const char* vibration_duration = "None\n100 ms\n150 ms\n200 ms\n250 ms\n300 ms\n350 ms\n400 ms";
|
||||||
#define SETTINGS_SCREEN_CATEGORY_SPACING_OUTER (10)
|
static const char* vibration_strength = "1\n2\n3\n4\n5\n6\n7\n8";
|
||||||
|
|
||||||
static const char * const day_options = "01\n02\n03\n04\n05\n06\n07\n08\n09\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n21\n22\n23\n24\n25\n26\n27\n28\n29\n30\n31";
|
static const char* language_options = "Francais\nDeutsch\nEnglish";
|
||||||
static const char * const month_options = "01\n02\n03\n04\n05\n06\n07\n08\n09\n10\n11\n12";
|
|
||||||
static const char * const year_options = "22\n23\n24\n25\n26\n27\n28\n29\n30\n31\n32\n33\n34\n35\n36\n37\n38\n39\n40";
|
|
||||||
static const char * const hour_options = "00\n01\n02\n03\n04\n05\n06\n07\n08\n09\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n21\n22\n23";
|
|
||||||
static const char * const second_minute_options = "00\n01\n02\n03\n04\n05\n06\n07\n08\n09\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n21\n22\n23\n24\n25\n26\n27\n28\n29\n30\n31\n32\n33\n34\n35\n36\n37\n38\n39\n40\n41\n42\n43\n44\n45\n46\n47\n48\n49\n50\n51\n52\n53\n54\n55\n56\n57\n58\n59";
|
|
||||||
static const char * const date_format = "dd/mm/yyyy\ndd/mm/yy\nyyyy/mm/dd\nyy/mm/dd";
|
|
||||||
|
|
||||||
static const char * const timeout_options = "Off\n5 seconds\n10 seconds\n15 seconds\n20 seconds\n25 seconds\n30 seconds\n35 seconds\n40 seconds\n45 seconds\n50 seconds\n55 seconds\n60 seconds";
|
|
||||||
static const char * const orientation_format = "Default\n90°\n180°\n270°";
|
|
||||||
static const char * const vibration_duration = "None\n100 ms\n150 ms\n200 ms\n250 ms\n300 ms\n350 ms\n400 ms";
|
|
||||||
static const char * const vibration_strength = "1\n2\n3\n4\n5\n6\n7\n8";
|
|
||||||
|
|
||||||
static const char * const language_options = "Francais\nDeutsch\nEnglish";
|
|
||||||
|
|
||||||
static const char * const default_version = "NaN";
|
|
||||||
|
|
||||||
typedef enum roller_id
|
typedef enum roller_id
|
||||||
{
|
{
|
||||||
@ -54,17 +42,12 @@ typedef enum switch_id
|
|||||||
|
|
||||||
static lv_obj_t *add_menu_list_item(lv_obj_t *list, const char *text, lv_event_cb_t event_cb, void *user_data, SettingsScreenCategory_e category);
|
static lv_obj_t *add_menu_list_item(lv_obj_t *list, const char *text, lv_event_cb_t event_cb, void *user_data, SettingsScreenCategory_e category);
|
||||||
static void update_menu_list_item_text(lv_obj_t *menu_list_item, const char *text);
|
static void update_menu_list_item_text(lv_obj_t *menu_list_item, const char *text);
|
||||||
static void _simulate_side_screen_item_click(SettingsScreen_t * const settingsScreen, lv_obj_t *item);
|
|
||||||
|
|
||||||
/* Helper functions used to update sensor label data */
|
static void _simulate_side_screen_item_click(SettingsScreen_t * const settingsScreen, lv_obj_t *item);
|
||||||
static void _set_rtc_time_to_label(SettingsScreen_t * const settingsScreen);
|
static void _set_rtc_time_to_label(SettingsScreen_t * const settingsScreen);
|
||||||
static void _set_battery_voltage_to_label(SettingsScreen_t * const settingsScreen);
|
static void _set_battery_voltage_to_label(SettingsScreen_t * const settingsScreen);
|
||||||
static void _set_magnetometer_axes_to_label(SettingsScreen_t * const settingsScreen);
|
static void _set_magnetometer_data_to_label(SettingsScreen_t * const settingsScreen);
|
||||||
static void _set_magnetometer_temperature_to_label(SettingsScreen_t * const settingsScreen);
|
static void _set_bmp280_data_to_label(SettingsScreen_t * const settingsScreen);
|
||||||
static void _set_accelerometer_axes_to_label(SettingsScreen_t * const settingsScreen);
|
|
||||||
static void _set_accelerometer_steps_and_temperature_to_label(SettingsScreen_t * const settingsScreen);
|
|
||||||
static void _set_pressure_sensor_to_label(SettingsScreen_t * const settingsScreen);
|
|
||||||
|
|
||||||
static void _enable_time_and_date_rollers(bool enabled, SettingsScreen_t * const settingsScreen);
|
static void _enable_time_and_date_rollers(bool enabled, SettingsScreen_t * const settingsScreen);
|
||||||
static void _show_ble_pairing_key(SettingsScreen_t * const settingsScreen, bool show);
|
static void _show_ble_pairing_key(SettingsScreen_t * const settingsScreen, bool show);
|
||||||
|
|
||||||
@ -79,7 +62,6 @@ static void _settings_screen_update_labels_language(SettingsScreen_t * const set
|
|||||||
update_menu_list_item_text(settingsScreen->display_item, translation_get_word(TRANSLATION_DISPLAY));
|
update_menu_list_item_text(settingsScreen->display_item, translation_get_word(TRANSLATION_DISPLAY));
|
||||||
update_menu_list_item_text(settingsScreen->notifications_item, translation_get_word(TRANSLATION_NOTIFICATIONS));
|
update_menu_list_item_text(settingsScreen->notifications_item, translation_get_word(TRANSLATION_NOTIFICATIONS));
|
||||||
update_menu_list_item_text(settingsScreen->connectivity_item, translation_get_word(TRANSLATION_CONNECTIVITY));
|
update_menu_list_item_text(settingsScreen->connectivity_item, translation_get_word(TRANSLATION_CONNECTIVITY));
|
||||||
update_menu_list_item_text(settingsScreen->sensors_item, translation_get_word(TRANSLATION_SENSORS));
|
|
||||||
update_menu_list_item_text(settingsScreen->language_item, translation_get_word(TRANSLATION_LANGUAGE));
|
update_menu_list_item_text(settingsScreen->language_item, translation_get_word(TRANSLATION_LANGUAGE));
|
||||||
update_menu_list_item_text(settingsScreen->about_item, translation_get_word(TRANSLATION_ABOUT));
|
update_menu_list_item_text(settingsScreen->about_item, translation_get_word(TRANSLATION_ABOUT));
|
||||||
}
|
}
|
||||||
@ -97,7 +79,7 @@ static void gesture_event_cb(lv_event_t *e)
|
|||||||
case LV_DIR_RIGHT:
|
case LV_DIR_RIGHT:
|
||||||
LV_LOG_USER("GESTURE : RIGHT");
|
LV_LOG_USER("GESTURE : RIGHT");
|
||||||
// We delete the timer if it was created
|
// We delete the timer if it was created
|
||||||
if(settingsScreen->sensors_refresh_timer)lv_timer_del(settingsScreen->sensors_refresh_timer);
|
if(settingsScreen->about_refresh_timer)lv_timer_del(settingsScreen->about_refresh_timer);
|
||||||
// We create the menu screen and switch to it
|
// We create the menu screen and switch to it
|
||||||
extern MenuScreen_t menuScreen;
|
extern MenuScreen_t menuScreen;
|
||||||
menu_screen_create(&menuScreen);
|
menu_screen_create(&menuScreen);
|
||||||
@ -324,26 +306,21 @@ static void factory_reset_cb(lv_event_t *e)
|
|||||||
if(settingsScreen->settingsScreenAPIInterface.factoryResetCb) settingsScreen->settingsScreenAPIInterface.factoryResetCb();
|
if(settingsScreen->settingsScreenAPIInterface.factoryResetCb) settingsScreen->settingsScreenAPIInterface.factoryResetCb();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sensors_refresh_timer_cb(lv_timer_t *timer)
|
static void about_refresh_timer_cb(lv_timer_t *timer)
|
||||||
{
|
{
|
||||||
SettingsScreen_t *settingsScreen = timer->user_data;
|
SettingsScreen_t *settingsScreen = timer->user_data;
|
||||||
|
|
||||||
/* Timer callback is called every 150 ms,
|
if(!settingsScreen->about_refresh_timer) return;
|
||||||
some data don't need that update rate */
|
|
||||||
static uint8_t timer_divider = 6;
|
|
||||||
|
|
||||||
|
static uint8_t timer_divider = 6;
|
||||||
if(timer_divider++ == 6)
|
if(timer_divider++ == 6)
|
||||||
{
|
{
|
||||||
_set_rtc_time_to_label(settingsScreen);
|
_set_rtc_time_to_label(settingsScreen);
|
||||||
_set_battery_voltage_to_label(settingsScreen);
|
_set_battery_voltage_to_label(settingsScreen);
|
||||||
_set_pressure_sensor_to_label(settingsScreen);
|
_set_bmp280_data_to_label(settingsScreen);
|
||||||
_set_magnetometer_temperature_to_label(settingsScreen);
|
|
||||||
_set_accelerometer_steps_and_temperature_to_label(settingsScreen);
|
|
||||||
timer_divider = 0;
|
timer_divider = 0;
|
||||||
}
|
}
|
||||||
|
_set_magnetometer_data_to_label(settingsScreen);
|
||||||
_set_magnetometer_axes_to_label(settingsScreen);
|
|
||||||
_set_accelerometer_axes_to_label(settingsScreen);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void load_time_and_date_side_screen(SettingsScreen_t *settingsScreen)
|
static void load_time_and_date_side_screen(SettingsScreen_t *settingsScreen)
|
||||||
@ -357,7 +334,7 @@ static void load_time_and_date_side_screen(SettingsScreen_t *settingsScreen)
|
|||||||
|
|
||||||
lv_obj_t *switch_obj = lv_switch_create(settingsScreen->side_screen);
|
lv_obj_t *switch_obj = lv_switch_create(settingsScreen->side_screen);
|
||||||
lv_obj_set_user_data(switch_obj, (void *)SWITCH_ID_AUTOMATIC_TIME_ENABLE);
|
lv_obj_set_user_data(switch_obj, (void *)SWITCH_ID_AUTOMATIC_TIME_ENABLE);
|
||||||
lv_obj_align_to(switch_obj, label, LV_ALIGN_OUT_BOTTOM_LEFT, 0, SETTINGS_SCREEN_CATEGORY_SPACING_OUTER);
|
lv_obj_align_to(switch_obj, label, LV_ALIGN_OUT_BOTTOM_LEFT, 0, 10);
|
||||||
bool auto_set_enable = false;
|
bool auto_set_enable = false;
|
||||||
if(settingsScreen->settingsScreenAPIInterface.setAutomaticTimeSettingsCb)settingsScreen->settingsScreenAPIInterface.setAutomaticTimeSettingsCb(&auto_set_enable, SETTING_MODE_GET);
|
if(settingsScreen->settingsScreenAPIInterface.setAutomaticTimeSettingsCb)settingsScreen->settingsScreenAPIInterface.setAutomaticTimeSettingsCb(&auto_set_enable, SETTING_MODE_GET);
|
||||||
if(auto_set_enable)
|
if(auto_set_enable)
|
||||||
@ -372,7 +349,7 @@ static void load_time_and_date_side_screen(SettingsScreen_t *settingsScreen)
|
|||||||
|
|
||||||
label = lv_label_create(settingsScreen->side_screen);
|
label = lv_label_create(settingsScreen->side_screen);
|
||||||
lv_label_set_text_static(label, "Time :");
|
lv_label_set_text_static(label, "Time :");
|
||||||
lv_obj_align_to(label, switch_obj, LV_ALIGN_OUT_BOTTOM_LEFT, 0, SETTINGS_SCREEN_CATEGORY_SPACING_OUTER);
|
lv_obj_align_to(label, switch_obj, LV_ALIGN_OUT_BOTTOM_LEFT, 0, 10);
|
||||||
|
|
||||||
settingsScreen->hour_roller = lv_roller_create(settingsScreen->side_screen);
|
settingsScreen->hour_roller = lv_roller_create(settingsScreen->side_screen);
|
||||||
settingsScreen->minute_roller = lv_roller_create(settingsScreen->side_screen);
|
settingsScreen->minute_roller = lv_roller_create(settingsScreen->side_screen);
|
||||||
@ -398,14 +375,14 @@ static void load_time_and_date_side_screen(SettingsScreen_t *settingsScreen)
|
|||||||
|
|
||||||
label = lv_label_create(settingsScreen->side_screen);
|
label = lv_label_create(settingsScreen->side_screen);
|
||||||
lv_label_set_text_static(label, "Time Format :");
|
lv_label_set_text_static(label, "Time Format :");
|
||||||
lv_obj_align_to(label, settingsScreen->hour_roller, LV_ALIGN_OUT_BOTTOM_LEFT, 0, SETTINGS_SCREEN_CATEGORY_SPACING_OUTER);
|
lv_obj_align_to(label, settingsScreen->hour_roller, LV_ALIGN_OUT_BOTTOM_LEFT, 0, 10);
|
||||||
|
|
||||||
bool is_24H_format = true;
|
bool is_24H_format = true;
|
||||||
if(settingsScreen->settingsScreenAPIInterface.setTimeFormatSettingsCb)settingsScreen->settingsScreenAPIInterface.setTimeFormatSettingsCb(&is_24H_format, SETTING_MODE_GET);
|
if(settingsScreen->settingsScreenAPIInterface.setTimeFormatSettingsCb)settingsScreen->settingsScreenAPIInterface.setTimeFormatSettingsCb(&is_24H_format, SETTING_MODE_GET);
|
||||||
settingsScreen->checkbox_time_12H = lv_checkbox_create(settingsScreen->side_screen);
|
settingsScreen->checkbox_time_12H = lv_checkbox_create(settingsScreen->side_screen);
|
||||||
lv_checkbox_set_text(settingsScreen->checkbox_time_12H, "12H");
|
lv_checkbox_set_text(settingsScreen->checkbox_time_12H, "12H");
|
||||||
lv_obj_set_style_radius(settingsScreen->checkbox_time_12H, LV_RADIUS_CIRCLE, LV_PART_INDICATOR);
|
lv_obj_set_style_radius(settingsScreen->checkbox_time_12H, LV_RADIUS_CIRCLE, LV_PART_INDICATOR);
|
||||||
lv_obj_align_to(settingsScreen->checkbox_time_12H, label, LV_ALIGN_OUT_BOTTOM_LEFT, 0, SETTINGS_SCREEN_CATEGORY_SPACING_OUTER);
|
lv_obj_align_to(settingsScreen->checkbox_time_12H, label, LV_ALIGN_OUT_BOTTOM_LEFT, 0, 10);
|
||||||
lv_obj_add_event_cb(settingsScreen->checkbox_time_12H, &(time_format_cb), LV_EVENT_CLICKED, settingsScreen);
|
lv_obj_add_event_cb(settingsScreen->checkbox_time_12H, &(time_format_cb), LV_EVENT_CLICKED, settingsScreen);
|
||||||
|
|
||||||
settingsScreen->checkbox_time_24H = lv_checkbox_create(settingsScreen->side_screen);
|
settingsScreen->checkbox_time_24H = lv_checkbox_create(settingsScreen->side_screen);
|
||||||
@ -427,14 +404,14 @@ static void load_time_and_date_side_screen(SettingsScreen_t *settingsScreen)
|
|||||||
|
|
||||||
label = lv_label_create(settingsScreen->side_screen);
|
label = lv_label_create(settingsScreen->side_screen);
|
||||||
lv_label_set_text_static(label, "Date :");
|
lv_label_set_text_static(label, "Date :");
|
||||||
lv_obj_align_to(label, settingsScreen->checkbox_time_12H, LV_ALIGN_OUT_BOTTOM_LEFT, 0, SETTINGS_SCREEN_CATEGORY_SPACING_OUTER);
|
lv_obj_align_to(label, settingsScreen->checkbox_time_12H, LV_ALIGN_OUT_BOTTOM_LEFT, 0, 10);
|
||||||
|
|
||||||
settingsScreen->day_roller = lv_roller_create(settingsScreen->side_screen);
|
settingsScreen->day_roller = lv_roller_create(settingsScreen->side_screen);
|
||||||
settingsScreen->month_roller = lv_roller_create(settingsScreen->side_screen);
|
settingsScreen->month_roller = lv_roller_create(settingsScreen->side_screen);
|
||||||
settingsScreen->year_roller = lv_roller_create(settingsScreen->side_screen);
|
settingsScreen->year_roller = lv_roller_create(settingsScreen->side_screen);
|
||||||
|
|
||||||
lv_roller_set_options(settingsScreen->day_roller, day_options, LV_ROLLER_MODE_NORMAL);
|
lv_roller_set_options(settingsScreen->day_roller, day_options, LV_ROLLER_MODE_NORMAL);
|
||||||
lv_obj_align_to(settingsScreen->day_roller, label, LV_ALIGN_OUT_BOTTOM_LEFT, 0, SETTINGS_SCREEN_CATEGORY_SPACING_OUTER);
|
lv_obj_align_to(settingsScreen->day_roller, label, LV_ALIGN_OUT_BOTTOM_LEFT, 0, 10);
|
||||||
lv_roller_set_visible_row_count(settingsScreen->day_roller, 2);
|
lv_roller_set_visible_row_count(settingsScreen->day_roller, 2);
|
||||||
lv_roller_set_selected(settingsScreen->day_roller, day-1, LV_ANIM_OFF);
|
lv_roller_set_selected(settingsScreen->day_roller, day-1, LV_ANIM_OFF);
|
||||||
lv_obj_add_event_cb(settingsScreen->day_roller, &(time_roller_cb), LV_EVENT_RELEASED, settingsScreen);
|
lv_obj_add_event_cb(settingsScreen->day_roller, &(time_roller_cb), LV_EVENT_RELEASED, settingsScreen);
|
||||||
@ -455,11 +432,11 @@ static void load_time_and_date_side_screen(SettingsScreen_t *settingsScreen)
|
|||||||
|
|
||||||
label = lv_label_create(settingsScreen->side_screen);
|
label = lv_label_create(settingsScreen->side_screen);
|
||||||
lv_label_set_text_static(label, "Date Format :");
|
lv_label_set_text_static(label, "Date Format :");
|
||||||
lv_obj_align_to(label, settingsScreen->day_roller, LV_ALIGN_OUT_BOTTOM_LEFT, 0, SETTINGS_SCREEN_CATEGORY_SPACING_OUTER);
|
lv_obj_align_to(label, settingsScreen->day_roller, LV_ALIGN_OUT_BOTTOM_LEFT, 0, 10);
|
||||||
|
|
||||||
lv_obj_t *date_dropdown = lv_dropdown_create(settingsScreen->side_screen);
|
lv_obj_t *date_dropdown = lv_dropdown_create(settingsScreen->side_screen);
|
||||||
lv_dropdown_set_options_static(date_dropdown, date_format);
|
lv_dropdown_set_options_static(date_dropdown, date_format);
|
||||||
lv_obj_align_to(date_dropdown, label, LV_ALIGN_OUT_BOTTOM_LEFT, 0, SETTINGS_SCREEN_CATEGORY_SPACING_OUTER);
|
lv_obj_align_to(date_dropdown, label, LV_ALIGN_OUT_BOTTOM_LEFT, 0, 10);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void load_display_side_screen(SettingsScreen_t *settingsScreen)
|
static void load_display_side_screen(SettingsScreen_t *settingsScreen)
|
||||||
@ -468,7 +445,7 @@ static void load_display_side_screen(SettingsScreen_t *settingsScreen)
|
|||||||
lv_label_set_text_static(label, "Brightness :");
|
lv_label_set_text_static(label, "Brightness :");
|
||||||
|
|
||||||
lv_obj_t *slider = lv_slider_create(settingsScreen->side_screen);
|
lv_obj_t *slider = lv_slider_create(settingsScreen->side_screen);
|
||||||
lv_obj_align_to(slider, label, LV_ALIGN_OUT_BOTTOM_LEFT, 10, SETTINGS_SCREEN_CATEGORY_SPACING_OUTER);
|
lv_obj_align_to(slider, label, LV_ALIGN_OUT_BOTTOM_LEFT, 10, 10);
|
||||||
lv_obj_clear_flag(slider, LV_OBJ_FLAG_GESTURE_BUBBLE);
|
lv_obj_clear_flag(slider, LV_OBJ_FLAG_GESTURE_BUBBLE);
|
||||||
lv_obj_set_width(slider, lv_pct(90));
|
lv_obj_set_width(slider, lv_pct(90));
|
||||||
lv_slider_set_range(slider, 1, 255);
|
lv_slider_set_range(slider, 1, 255);
|
||||||
@ -479,10 +456,10 @@ static void load_display_side_screen(SettingsScreen_t *settingsScreen)
|
|||||||
|
|
||||||
label = lv_label_create(settingsScreen->side_screen);
|
label = lv_label_create(settingsScreen->side_screen);
|
||||||
lv_label_set_text_static(label, "Display Off After :");
|
lv_label_set_text_static(label, "Display Off After :");
|
||||||
lv_obj_align_to(label, slider, LV_ALIGN_OUT_BOTTOM_LEFT, -10, SETTINGS_SCREEN_CATEGORY_SPACING_OUTER);
|
lv_obj_align_to(label, slider, LV_ALIGN_OUT_BOTTOM_LEFT, -10, 10);
|
||||||
|
|
||||||
lv_obj_t *timeout_roller = lv_roller_create(settingsScreen->side_screen);
|
lv_obj_t *timeout_roller = lv_roller_create(settingsScreen->side_screen);
|
||||||
lv_obj_align_to(timeout_roller, label, LV_ALIGN_OUT_BOTTOM_LEFT, 10, SETTINGS_SCREEN_CATEGORY_SPACING_OUTER);
|
lv_obj_align_to(timeout_roller, label, LV_ALIGN_OUT_BOTTOM_LEFT, 10, 10);
|
||||||
lv_roller_set_options(timeout_roller, timeout_options, LV_ROLLER_MODE_NORMAL);
|
lv_roller_set_options(timeout_roller, timeout_options, LV_ROLLER_MODE_NORMAL);
|
||||||
lv_roller_set_visible_row_count(timeout_roller, 2);
|
lv_roller_set_visible_row_count(timeout_roller, 2);
|
||||||
uint8_t timeout = 0;
|
uint8_t timeout = 0;
|
||||||
@ -492,10 +469,10 @@ static void load_display_side_screen(SettingsScreen_t *settingsScreen)
|
|||||||
|
|
||||||
label = lv_label_create(settingsScreen->side_screen);
|
label = lv_label_create(settingsScreen->side_screen);
|
||||||
lv_label_set_text_static(label, "Screen Orientation :");
|
lv_label_set_text_static(label, "Screen Orientation :");
|
||||||
lv_obj_align_to(label, timeout_roller, LV_ALIGN_OUT_BOTTOM_LEFT, -10, SETTINGS_SCREEN_CATEGORY_SPACING_OUTER);
|
lv_obj_align_to(label, timeout_roller, LV_ALIGN_OUT_BOTTOM_LEFT, -10, 10);
|
||||||
|
|
||||||
lv_obj_t *orientation_dropdown = lv_dropdown_create(settingsScreen->side_screen);
|
lv_obj_t *orientation_dropdown = lv_dropdown_create(settingsScreen->side_screen);
|
||||||
lv_obj_align_to(orientation_dropdown, label, LV_ALIGN_OUT_BOTTOM_LEFT, 0, SETTINGS_SCREEN_CATEGORY_SPACING_OUTER);
|
lv_obj_align_to(orientation_dropdown, label, LV_ALIGN_OUT_BOTTOM_LEFT, 0, 10);
|
||||||
lv_dropdown_set_options_static(orientation_dropdown, orientation_format);
|
lv_dropdown_set_options_static(orientation_dropdown, orientation_format);
|
||||||
uint8_t orientation = 0;
|
uint8_t orientation = 0;
|
||||||
if(settingsScreen->settingsScreenAPIInterface.setOrientationSettingsCb)settingsScreen->settingsScreenAPIInterface.setOrientationSettingsCb(&orientation, SETTING_MODE_GET);
|
if(settingsScreen->settingsScreenAPIInterface.setOrientationSettingsCb)settingsScreen->settingsScreenAPIInterface.setOrientationSettingsCb(&orientation, SETTING_MODE_GET);
|
||||||
@ -504,14 +481,14 @@ static void load_display_side_screen(SettingsScreen_t *settingsScreen)
|
|||||||
|
|
||||||
label = lv_label_create(settingsScreen->side_screen);
|
label = lv_label_create(settingsScreen->side_screen);
|
||||||
lv_label_set_text_static(label, "Wakeup :");
|
lv_label_set_text_static(label, "Wakeup :");
|
||||||
lv_obj_align_to(label, orientation_dropdown, LV_ALIGN_OUT_BOTTOM_LEFT, 0, SETTINGS_SCREEN_CATEGORY_SPACING_OUTER);
|
lv_obj_align_to(label, orientation_dropdown, LV_ALIGN_OUT_BOTTOM_LEFT, 0, 10);
|
||||||
|
|
||||||
lv_obj_t *switch_obj = lv_switch_create(settingsScreen->side_screen);
|
lv_obj_t *switch_obj = lv_switch_create(settingsScreen->side_screen);
|
||||||
lv_obj_set_user_data(switch_obj, (void *)SWITCH_ID_WRIST_TILT_ENABLE);
|
lv_obj_set_user_data(switch_obj, (void *)SWITCH_ID_WRIST_TILT_ENABLE);
|
||||||
bool toggled = false;
|
bool toggled = false;
|
||||||
if(settingsScreen->settingsScreenAPIInterface.setWristTiltSettingsCb)settingsScreen->settingsScreenAPIInterface.setWristTiltSettingsCb(&toggled, SETTING_MODE_GET);
|
if(settingsScreen->settingsScreenAPIInterface.setWristTiltSettingsCb)settingsScreen->settingsScreenAPIInterface.setWristTiltSettingsCb(&toggled, SETTING_MODE_GET);
|
||||||
if(toggled)lv_obj_add_state(switch_obj, LV_STATE_CHECKED);
|
if(toggled)lv_obj_add_state(switch_obj, LV_STATE_CHECKED);
|
||||||
lv_obj_align_to(switch_obj, label, LV_ALIGN_OUT_BOTTOM_LEFT, 0, SETTINGS_SCREEN_CATEGORY_SPACING_OUTER);
|
lv_obj_align_to(switch_obj, label, LV_ALIGN_OUT_BOTTOM_LEFT, 0, 10);
|
||||||
lv_obj_add_event_cb(switch_obj, &(activation_switch_cb), LV_EVENT_VALUE_CHANGED, settingsScreen);
|
lv_obj_add_event_cb(switch_obj, &(activation_switch_cb), LV_EVENT_VALUE_CHANGED, settingsScreen);
|
||||||
|
|
||||||
label = lv_label_create(settingsScreen->side_screen);
|
label = lv_label_create(settingsScreen->side_screen);
|
||||||
@ -520,10 +497,10 @@ static void load_display_side_screen(SettingsScreen_t *settingsScreen)
|
|||||||
|
|
||||||
label = lv_label_create(settingsScreen->side_screen);
|
label = lv_label_create(settingsScreen->side_screen);
|
||||||
lv_label_set_text_static(label, "Vibrate On Touch :");
|
lv_label_set_text_static(label, "Vibrate On Touch :");
|
||||||
lv_obj_align_to(label, switch_obj, LV_ALIGN_OUT_BOTTOM_LEFT, 0, SETTINGS_SCREEN_CATEGORY_SPACING_OUTER);
|
lv_obj_align_to(label, switch_obj, LV_ALIGN_OUT_BOTTOM_LEFT, 0, 10);
|
||||||
|
|
||||||
lv_obj_t *on_touch_vibration_duration_roller = lv_roller_create(settingsScreen->side_screen);
|
lv_obj_t *on_touch_vibration_duration_roller = lv_roller_create(settingsScreen->side_screen);
|
||||||
lv_obj_align_to(on_touch_vibration_duration_roller, label, LV_ALIGN_OUT_BOTTOM_LEFT, 0, SETTINGS_SCREEN_CATEGORY_SPACING_OUTER);
|
lv_obj_align_to(on_touch_vibration_duration_roller, label, LV_ALIGN_OUT_BOTTOM_LEFT, 0, 10);
|
||||||
lv_roller_set_options(on_touch_vibration_duration_roller, vibration_duration, LV_ROLLER_MODE_NORMAL);
|
lv_roller_set_options(on_touch_vibration_duration_roller, vibration_duration, LV_ROLLER_MODE_NORMAL);
|
||||||
lv_obj_set_user_data(on_touch_vibration_duration_roller, (void *)ROLLER_ID_TOUCH_VIBRATION_DURATION);
|
lv_obj_set_user_data(on_touch_vibration_duration_roller, (void *)ROLLER_ID_TOUCH_VIBRATION_DURATION);
|
||||||
lv_roller_set_visible_row_count(on_touch_vibration_duration_roller, 2);
|
lv_roller_set_visible_row_count(on_touch_vibration_duration_roller, 2);
|
||||||
@ -537,7 +514,7 @@ static void load_display_side_screen(SettingsScreen_t *settingsScreen)
|
|||||||
lv_obj_align_to(label, on_touch_vibration_duration_roller, LV_ALIGN_OUT_RIGHT_MID, 5, 0);
|
lv_obj_align_to(label, on_touch_vibration_duration_roller, LV_ALIGN_OUT_RIGHT_MID, 5, 0);
|
||||||
|
|
||||||
lv_obj_t *on_touch_vibration_strength_roller = lv_roller_create(settingsScreen->side_screen);
|
lv_obj_t *on_touch_vibration_strength_roller = lv_roller_create(settingsScreen->side_screen);
|
||||||
lv_obj_align_to(on_touch_vibration_strength_roller, on_touch_vibration_duration_roller, LV_ALIGN_OUT_BOTTOM_LEFT, 0, SETTINGS_SCREEN_CATEGORY_SPACING_OUTER);
|
lv_obj_align_to(on_touch_vibration_strength_roller, on_touch_vibration_duration_roller, LV_ALIGN_OUT_BOTTOM_LEFT, 0, 10);
|
||||||
lv_roller_set_options(on_touch_vibration_strength_roller, vibration_strength, LV_ROLLER_MODE_NORMAL);
|
lv_roller_set_options(on_touch_vibration_strength_roller, vibration_strength, LV_ROLLER_MODE_NORMAL);
|
||||||
lv_obj_set_user_data(on_touch_vibration_strength_roller, (void *)ROLLER_ID_TOUCH_VIBRATION_STRENGTH);
|
lv_obj_set_user_data(on_touch_vibration_strength_roller, (void *)ROLLER_ID_TOUCH_VIBRATION_STRENGTH);
|
||||||
lv_roller_set_visible_row_count(on_touch_vibration_strength_roller, 2);
|
lv_roller_set_visible_row_count(on_touch_vibration_strength_roller, 2);
|
||||||
@ -565,7 +542,7 @@ static void load_notifications_side_screen(SettingsScreen_t *settingsScreen)
|
|||||||
if(settingsScreen->settingsScreenAPIInterface.setNotificationEnabledSettingsCb)
|
if(settingsScreen->settingsScreenAPIInterface.setNotificationEnabledSettingsCb)
|
||||||
settingsScreen->settingsScreenAPIInterface.setNotificationEnabledSettingsCb(&toggled, SETTING_MODE_GET);
|
settingsScreen->settingsScreenAPIInterface.setNotificationEnabledSettingsCb(&toggled, SETTING_MODE_GET);
|
||||||
if(toggled)lv_obj_add_state(notification_enable_switch, LV_STATE_CHECKED);
|
if(toggled)lv_obj_add_state(notification_enable_switch, LV_STATE_CHECKED);
|
||||||
lv_obj_align_to(notification_enable_switch, label, LV_ALIGN_OUT_BOTTOM_LEFT, 0, SETTINGS_SCREEN_CATEGORY_SPACING_OUTER);
|
lv_obj_align_to(notification_enable_switch, label, LV_ALIGN_OUT_BOTTOM_LEFT, 0, 10);
|
||||||
lv_obj_add_event_cb(notification_enable_switch, &(activation_switch_cb), LV_EVENT_VALUE_CHANGED, settingsScreen);
|
lv_obj_add_event_cb(notification_enable_switch, &(activation_switch_cb), LV_EVENT_VALUE_CHANGED, settingsScreen);
|
||||||
|
|
||||||
label = lv_label_create(settingsScreen->side_screen);
|
label = lv_label_create(settingsScreen->side_screen);
|
||||||
@ -574,7 +551,7 @@ static void load_notifications_side_screen(SettingsScreen_t *settingsScreen)
|
|||||||
|
|
||||||
label = lv_label_create(settingsScreen->side_screen);
|
label = lv_label_create(settingsScreen->side_screen);
|
||||||
lv_label_set_text_static(label, "Vibrate On\nNotifications :");
|
lv_label_set_text_static(label, "Vibrate On\nNotifications :");
|
||||||
lv_obj_align_to(label, notification_enable_switch, LV_ALIGN_OUT_BOTTOM_LEFT, 0, SETTINGS_SCREEN_CATEGORY_SPACING_OUTER);
|
lv_obj_align_to(label, notification_enable_switch, LV_ALIGN_OUT_BOTTOM_LEFT, 0, 10);
|
||||||
|
|
||||||
lv_obj_t *on_notification_vibration_duration_roller = lv_roller_create(settingsScreen->side_screen);
|
lv_obj_t *on_notification_vibration_duration_roller = lv_roller_create(settingsScreen->side_screen);
|
||||||
lv_obj_align_to(on_notification_vibration_duration_roller, label, LV_ALIGN_OUT_BOTTOM_LEFT, 0, 10);
|
lv_obj_align_to(on_notification_vibration_duration_roller, label, LV_ALIGN_OUT_BOTTOM_LEFT, 0, 10);
|
||||||
@ -592,7 +569,7 @@ static void load_notifications_side_screen(SettingsScreen_t *settingsScreen)
|
|||||||
lv_obj_align_to(label, on_notification_vibration_duration_roller, LV_ALIGN_OUT_RIGHT_MID, 5, 0);
|
lv_obj_align_to(label, on_notification_vibration_duration_roller, LV_ALIGN_OUT_RIGHT_MID, 5, 0);
|
||||||
|
|
||||||
lv_obj_t *on_notification_vibration_strength_roller = lv_roller_create(settingsScreen->side_screen);
|
lv_obj_t *on_notification_vibration_strength_roller = lv_roller_create(settingsScreen->side_screen);
|
||||||
lv_obj_align_to(on_notification_vibration_strength_roller, on_notification_vibration_duration_roller, LV_ALIGN_OUT_BOTTOM_LEFT, 0, SETTINGS_SCREEN_CATEGORY_SPACING_OUTER);
|
lv_obj_align_to(on_notification_vibration_strength_roller, on_notification_vibration_duration_roller, LV_ALIGN_OUT_BOTTOM_LEFT, 0, 10);
|
||||||
lv_roller_set_options(on_notification_vibration_strength_roller, vibration_strength, LV_ROLLER_MODE_NORMAL);
|
lv_roller_set_options(on_notification_vibration_strength_roller, vibration_strength, LV_ROLLER_MODE_NORMAL);
|
||||||
lv_obj_set_user_data(on_notification_vibration_strength_roller, (void *)ROLLER_ID_NOTIFICATION_VIBRATION_STRENGTH);
|
lv_obj_set_user_data(on_notification_vibration_strength_roller, (void *)ROLLER_ID_NOTIFICATION_VIBRATION_STRENGTH);
|
||||||
lv_roller_set_visible_row_count(on_notification_vibration_strength_roller, 2);
|
lv_roller_set_visible_row_count(on_notification_vibration_strength_roller, 2);
|
||||||
@ -610,7 +587,7 @@ static void load_notifications_side_screen(SettingsScreen_t *settingsScreen)
|
|||||||
//Calls notification header text
|
//Calls notification header text
|
||||||
label = lv_label_create(settingsScreen->side_screen);
|
label = lv_label_create(settingsScreen->side_screen);
|
||||||
lv_label_set_text_static(label, "Calls\nNotifications :");
|
lv_label_set_text_static(label, "Calls\nNotifications :");
|
||||||
lv_obj_align_to(label, on_notification_vibration_strength_roller, LV_ALIGN_OUT_BOTTOM_LEFT, 0, SETTINGS_SCREEN_CATEGORY_SPACING_OUTER);
|
lv_obj_align_to(label, on_notification_vibration_strength_roller, LV_ALIGN_OUT_BOTTOM_LEFT, 0, 10);
|
||||||
|
|
||||||
// Call enable switch
|
// Call enable switch
|
||||||
lv_obj_t *call_enable_switch = lv_switch_create(settingsScreen->side_screen);
|
lv_obj_t *call_enable_switch = lv_switch_create(settingsScreen->side_screen);
|
||||||
@ -619,7 +596,7 @@ static void load_notifications_side_screen(SettingsScreen_t *settingsScreen)
|
|||||||
if(settingsScreen->settingsScreenAPIInterface.setCallEnabledSettingsCb)
|
if(settingsScreen->settingsScreenAPIInterface.setCallEnabledSettingsCb)
|
||||||
settingsScreen->settingsScreenAPIInterface.setCallEnabledSettingsCb(&toggled, SETTING_MODE_GET);
|
settingsScreen->settingsScreenAPIInterface.setCallEnabledSettingsCb(&toggled, SETTING_MODE_GET);
|
||||||
if(toggled)lv_obj_add_state(call_enable_switch, LV_STATE_CHECKED);
|
if(toggled)lv_obj_add_state(call_enable_switch, LV_STATE_CHECKED);
|
||||||
lv_obj_align_to(call_enable_switch, label, LV_ALIGN_OUT_BOTTOM_LEFT, 0, SETTINGS_SCREEN_CATEGORY_SPACING_OUTER);
|
lv_obj_align_to(call_enable_switch, label, LV_ALIGN_OUT_BOTTOM_LEFT, 0, 10);
|
||||||
lv_obj_add_event_cb(call_enable_switch, &(activation_switch_cb), LV_EVENT_VALUE_CHANGED, settingsScreen);
|
lv_obj_add_event_cb(call_enable_switch, &(activation_switch_cb), LV_EVENT_VALUE_CHANGED, settingsScreen);
|
||||||
|
|
||||||
label = lv_label_create(settingsScreen->side_screen);
|
label = lv_label_create(settingsScreen->side_screen);
|
||||||
@ -628,10 +605,10 @@ static void load_notifications_side_screen(SettingsScreen_t *settingsScreen)
|
|||||||
|
|
||||||
label = lv_label_create(settingsScreen->side_screen);
|
label = lv_label_create(settingsScreen->side_screen);
|
||||||
lv_label_set_text_static(label, "Vibrate On Calls :");
|
lv_label_set_text_static(label, "Vibrate On Calls :");
|
||||||
lv_obj_align_to(label, call_enable_switch, LV_ALIGN_OUT_BOTTOM_LEFT, 0, SETTINGS_SCREEN_CATEGORY_SPACING_OUTER);
|
lv_obj_align_to(label, call_enable_switch, LV_ALIGN_OUT_BOTTOM_LEFT, 0, 10);
|
||||||
|
|
||||||
lv_obj_t *on_call_vibration_duration_roller = lv_roller_create(settingsScreen->side_screen);
|
lv_obj_t *on_call_vibration_duration_roller = lv_roller_create(settingsScreen->side_screen);
|
||||||
lv_obj_align_to(on_call_vibration_duration_roller, label, LV_ALIGN_OUT_BOTTOM_LEFT, 0, SETTINGS_SCREEN_CATEGORY_SPACING_OUTER);
|
lv_obj_align_to(on_call_vibration_duration_roller, label, LV_ALIGN_OUT_BOTTOM_LEFT, 0, 10);
|
||||||
lv_roller_set_options(on_call_vibration_duration_roller, vibration_duration, LV_ROLLER_MODE_NORMAL);
|
lv_roller_set_options(on_call_vibration_duration_roller, vibration_duration, LV_ROLLER_MODE_NORMAL);
|
||||||
lv_obj_set_user_data(on_call_vibration_duration_roller, (void *)ROLLER_ID_CALL_VIBRATION_DURATION);
|
lv_obj_set_user_data(on_call_vibration_duration_roller, (void *)ROLLER_ID_CALL_VIBRATION_DURATION);
|
||||||
lv_roller_set_visible_row_count(on_call_vibration_duration_roller, 2);
|
lv_roller_set_visible_row_count(on_call_vibration_duration_roller, 2);
|
||||||
@ -646,7 +623,7 @@ static void load_notifications_side_screen(SettingsScreen_t *settingsScreen)
|
|||||||
lv_obj_align_to(label, on_call_vibration_duration_roller, LV_ALIGN_OUT_RIGHT_MID, 5, 0);
|
lv_obj_align_to(label, on_call_vibration_duration_roller, LV_ALIGN_OUT_RIGHT_MID, 5, 0);
|
||||||
|
|
||||||
lv_obj_t *on_call_vibration_strength_roller = lv_roller_create(settingsScreen->side_screen);
|
lv_obj_t *on_call_vibration_strength_roller = lv_roller_create(settingsScreen->side_screen);
|
||||||
lv_obj_align_to(on_call_vibration_strength_roller, on_call_vibration_duration_roller, LV_ALIGN_OUT_BOTTOM_LEFT, 0, SETTINGS_SCREEN_CATEGORY_SPACING_OUTER);
|
lv_obj_align_to(on_call_vibration_strength_roller, on_call_vibration_duration_roller, LV_ALIGN_OUT_BOTTOM_LEFT, 0, 10);
|
||||||
lv_roller_set_options(on_call_vibration_strength_roller, vibration_strength, LV_ROLLER_MODE_NORMAL);
|
lv_roller_set_options(on_call_vibration_strength_roller, vibration_strength, LV_ROLLER_MODE_NORMAL);
|
||||||
lv_obj_set_user_data(on_call_vibration_strength_roller, (void *)ROLLER_ID_CALL_VIBRATION_STRENGTH);
|
lv_obj_set_user_data(on_call_vibration_strength_roller, (void *)ROLLER_ID_CALL_VIBRATION_STRENGTH);
|
||||||
lv_roller_set_visible_row_count(on_call_vibration_strength_roller, 2);
|
lv_roller_set_visible_row_count(on_call_vibration_strength_roller, 2);
|
||||||
@ -664,41 +641,45 @@ static void load_notifications_side_screen(SettingsScreen_t *settingsScreen)
|
|||||||
|
|
||||||
static void load_connectivity_side_screen(SettingsScreen_t *settingsScreen)
|
static void load_connectivity_side_screen(SettingsScreen_t *settingsScreen)
|
||||||
{
|
{
|
||||||
|
lv_obj_t *label = lv_label_create(settingsScreen->side_screen);
|
||||||
|
lv_label_set_text_static(label, "Connectivity :");
|
||||||
|
|
||||||
settingsScreen->ble_switch = lv_switch_create(settingsScreen->side_screen);
|
settingsScreen->ble_switch = lv_switch_create(settingsScreen->side_screen);
|
||||||
lv_obj_set_user_data(settingsScreen->ble_switch, (void *)SWITCH_ID_BLE_ENABLE);
|
lv_obj_set_user_data(settingsScreen->ble_switch, (void *)SWITCH_ID_BLE_ENABLE);
|
||||||
|
lv_obj_align_to(settingsScreen->ble_switch, label, LV_ALIGN_OUT_BOTTOM_LEFT, 0, 10);
|
||||||
bool ble_toggled = false;
|
bool ble_toggled = false;
|
||||||
if(settingsScreen->settingsScreenAPIInterface.setBLEEnabledSettingsCb)settingsScreen->settingsScreenAPIInterface.setBLEEnabledSettingsCb(&ble_toggled, SETTING_MODE_GET);
|
if(settingsScreen->settingsScreenAPIInterface.setBLEEnabledSettingsCb)settingsScreen->settingsScreenAPIInterface.setBLEEnabledSettingsCb(&ble_toggled, SETTING_MODE_GET);
|
||||||
if(ble_toggled) lv_obj_add_state(settingsScreen->ble_switch, LV_STATE_CHECKED);
|
if(ble_toggled) lv_obj_add_state(settingsScreen->ble_switch, LV_STATE_CHECKED);
|
||||||
lv_obj_add_event_cb(settingsScreen->ble_switch, &(activation_switch_cb), LV_EVENT_VALUE_CHANGED, settingsScreen);
|
lv_obj_add_event_cb(settingsScreen->ble_switch, &(activation_switch_cb), LV_EVENT_VALUE_CHANGED, settingsScreen);
|
||||||
|
|
||||||
lv_obj_t *label = lv_label_create(settingsScreen->side_screen);
|
label = lv_label_create(settingsScreen->side_screen);
|
||||||
lv_label_set_text_static(label, "Bluetooth");
|
lv_label_set_text_static(label, "Bluetooth");
|
||||||
lv_obj_align_to(label, settingsScreen->ble_switch, LV_ALIGN_OUT_RIGHT_MID, 10, 0);
|
lv_obj_align_to(label, settingsScreen->ble_switch, LV_ALIGN_OUT_RIGHT_MID, 10, 0);
|
||||||
|
|
||||||
settingsScreen->ble_pairing_label = lv_label_create(settingsScreen->side_screen);
|
settingsScreen->ble_pairing_label = lv_label_create(settingsScreen->side_screen);
|
||||||
lv_label_set_text_static(settingsScreen->ble_pairing_label, "Pairing Code :");
|
lv_label_set_text_static(settingsScreen->ble_pairing_label, "Pairing Code :");
|
||||||
lv_obj_align_to(settingsScreen->ble_pairing_label, settingsScreen->ble_switch, LV_ALIGN_OUT_BOTTOM_LEFT, 0, SETTINGS_SCREEN_CATEGORY_SPACING_OUTER);
|
lv_obj_align_to(settingsScreen->ble_pairing_label, settingsScreen->ble_switch, LV_ALIGN_OUT_BOTTOM_LEFT, 0, 5);
|
||||||
lv_obj_add_flag(settingsScreen->ble_pairing_label, LV_OBJ_FLAG_HIDDEN);
|
lv_obj_add_flag(settingsScreen->ble_pairing_label, LV_OBJ_FLAG_HIDDEN);
|
||||||
|
|
||||||
settingsScreen->ble_pairing_key.label = lv_label_create(settingsScreen->side_screen);
|
settingsScreen->ble_pairing_key.label = lv_label_create(settingsScreen->side_screen);
|
||||||
lv_obj_set_style_text_color(settingsScreen->ble_pairing_key.label, lv_color_make(130, 130, 130), LV_PART_MAIN);
|
lv_obj_set_style_text_color(settingsScreen->ble_pairing_key.label, lv_color_make(130, 130, 130), LV_PART_MAIN);
|
||||||
lv_obj_align_to(settingsScreen->ble_pairing_key.label, settingsScreen->ble_pairing_label, LV_ALIGN_OUT_BOTTOM_LEFT, 0, SETTINGS_SCREEN_CATEGORY_SPACING_INNER);
|
lv_obj_align_to(settingsScreen->ble_pairing_key.label, settingsScreen->ble_pairing_label, LV_ALIGN_OUT_BOTTOM_LEFT, 0, 5);
|
||||||
lv_obj_add_flag(settingsScreen->ble_pairing_key.label, LV_OBJ_FLAG_HIDDEN);
|
lv_obj_add_flag(settingsScreen->ble_pairing_key.label, LV_OBJ_FLAG_HIDDEN);
|
||||||
|
|
||||||
settingsScreen->ble_dev_name_label = lv_label_create(settingsScreen->side_screen);
|
settingsScreen->ble_dev_name_label = lv_label_create(settingsScreen->side_screen);
|
||||||
lv_label_set_text_static(settingsScreen->ble_dev_name_label, "Device Name :");
|
lv_label_set_text_static(settingsScreen->ble_dev_name_label, "Device Name :");
|
||||||
lv_obj_align_to(settingsScreen->ble_dev_name_label, settingsScreen->ble_switch, LV_ALIGN_OUT_BOTTOM_LEFT, 0, SETTINGS_SCREEN_CATEGORY_SPACING_OUTER);
|
lv_obj_align_to(settingsScreen->ble_dev_name_label, settingsScreen->ble_switch, LV_ALIGN_OUT_BOTTOM_LEFT, 0, 5);
|
||||||
|
|
||||||
settingsScreen->ble_dev_name_value = lv_label_create(settingsScreen->side_screen);
|
settingsScreen->ble_dev_name_value = lv_label_create(settingsScreen->side_screen);
|
||||||
const char * ble_dev_name = NULL;
|
const char * ble_dev_name = NULL;
|
||||||
if(settingsScreen->settingsScreenAPIInterface.getBLEDeviceNameCb) settingsScreen->settingsScreenAPIInterface.getBLEDeviceNameCb(&ble_dev_name);
|
if(settingsScreen->settingsScreenAPIInterface.getBLEDeviceNameCb) settingsScreen->settingsScreenAPIInterface.getBLEDeviceNameCb(&ble_dev_name);
|
||||||
lv_label_set_text_static(settingsScreen->ble_dev_name_value, ble_dev_name);
|
lv_label_set_text_static(settingsScreen->ble_dev_name_value, ble_dev_name);
|
||||||
lv_obj_set_style_text_color(settingsScreen->ble_dev_name_value, lv_color_make(130, 130, 130), LV_PART_MAIN);
|
lv_obj_set_style_text_color(settingsScreen->ble_dev_name_value, lv_color_make(130, 130, 130), LV_PART_MAIN);
|
||||||
lv_obj_align_to(settingsScreen->ble_dev_name_value, settingsScreen->ble_dev_name_label, LV_ALIGN_OUT_BOTTOM_LEFT, 0, SETTINGS_SCREEN_CATEGORY_SPACING_INNER);
|
lv_obj_align_to(settingsScreen->ble_dev_name_value, settingsScreen->ble_dev_name_label, LV_ALIGN_OUT_BOTTOM_LEFT, 0, 5);
|
||||||
|
|
||||||
settingsScreen->ble_dev_mac_label = lv_label_create(settingsScreen->side_screen);
|
settingsScreen->ble_dev_mac_label = lv_label_create(settingsScreen->side_screen);
|
||||||
lv_label_set_text_static(settingsScreen->ble_dev_mac_label, "Device MAC :");
|
lv_label_set_text_static(settingsScreen->ble_dev_mac_label, "Device MAC :");
|
||||||
lv_obj_align_to(settingsScreen->ble_dev_mac_label, settingsScreen->ble_dev_name_value, LV_ALIGN_OUT_BOTTOM_LEFT, 0, SETTINGS_SCREEN_CATEGORY_SPACING_OUTER);
|
lv_obj_align_to(settingsScreen->ble_dev_mac_label, settingsScreen->ble_dev_name_value, LV_ALIGN_OUT_BOTTOM_LEFT, 0, 5);
|
||||||
|
|
||||||
settingsScreen->ble_mac_addr.label = lv_label_create(settingsScreen->side_screen);
|
settingsScreen->ble_mac_addr.label = lv_label_create(settingsScreen->side_screen);
|
||||||
const uint8_t *ble_dev_mac = NULL;
|
const uint8_t *ble_dev_mac = NULL;
|
||||||
@ -714,11 +695,11 @@ static void load_connectivity_side_screen(SettingsScreen_t *settingsScreen)
|
|||||||
}
|
}
|
||||||
lv_label_set_text_static(settingsScreen->ble_mac_addr.label, settingsScreen->ble_mac_addr.text);
|
lv_label_set_text_static(settingsScreen->ble_mac_addr.label, settingsScreen->ble_mac_addr.text);
|
||||||
lv_obj_set_style_text_color(settingsScreen->ble_mac_addr.label, lv_color_make(130, 130, 130), LV_PART_MAIN);
|
lv_obj_set_style_text_color(settingsScreen->ble_mac_addr.label, lv_color_make(130, 130, 130), LV_PART_MAIN);
|
||||||
lv_obj_align_to(settingsScreen->ble_mac_addr.label, settingsScreen->ble_dev_mac_label, LV_ALIGN_OUT_BOTTOM_LEFT, 0, SETTINGS_SCREEN_CATEGORY_SPACING_INNER);
|
lv_obj_align_to(settingsScreen->ble_mac_addr.label, settingsScreen->ble_dev_mac_label, LV_ALIGN_OUT_BOTTOM_LEFT, 0, 5);
|
||||||
|
|
||||||
settingsScreen->wifi_switch = lv_switch_create(settingsScreen->side_screen);
|
settingsScreen->wifi_switch = lv_switch_create(settingsScreen->side_screen);
|
||||||
lv_obj_set_user_data(settingsScreen->wifi_switch, (void *)SWITCH_ID_WIFI_ENABLE);
|
lv_obj_set_user_data(settingsScreen->wifi_switch, (void *)SWITCH_ID_WIFI_ENABLE);
|
||||||
lv_obj_align_to(settingsScreen->wifi_switch, settingsScreen->ble_mac_addr.label, LV_ALIGN_OUT_BOTTOM_LEFT, 0, SETTINGS_SCREEN_CATEGORY_SPACING_OUTER);
|
lv_obj_align_to(settingsScreen->wifi_switch, settingsScreen->ble_mac_addr.label, LV_ALIGN_OUT_BOTTOM_LEFT, 0, 10);
|
||||||
bool wifi_toggled = false;
|
bool wifi_toggled = false;
|
||||||
if(settingsScreen->settingsScreenAPIInterface.setWiFiEnabledSettingsCb)settingsScreen->settingsScreenAPIInterface.setWiFiEnabledSettingsCb(&wifi_toggled, SETTING_MODE_GET);
|
if(settingsScreen->settingsScreenAPIInterface.setWiFiEnabledSettingsCb)settingsScreen->settingsScreenAPIInterface.setWiFiEnabledSettingsCb(&wifi_toggled, SETTING_MODE_GET);
|
||||||
if(wifi_toggled) lv_obj_add_state(settingsScreen->wifi_switch, LV_STATE_CHECKED);
|
if(wifi_toggled) lv_obj_add_state(settingsScreen->wifi_switch, LV_STATE_CHECKED);
|
||||||
@ -733,119 +714,13 @@ static void load_connectivity_side_screen(SettingsScreen_t *settingsScreen)
|
|||||||
_show_ble_pairing_key(settingsScreen, ble_toggled);
|
_show_ble_pairing_key(settingsScreen, ble_toggled);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void load_sensors_side_screen(SettingsScreen_t *settingsScreen)
|
|
||||||
{
|
|
||||||
/* First, display the RTC time */
|
|
||||||
lv_obj_t *rtc_time = lv_label_create(settingsScreen->side_screen);
|
|
||||||
lv_label_set_text_static(rtc_time, "System Clock :");
|
|
||||||
|
|
||||||
settingsScreen->sensors_labels.clock.label = lv_label_create(settingsScreen->side_screen);
|
|
||||||
lv_obj_set_style_text_color(settingsScreen->sensors_labels.clock.label, lv_color_make(130, 130, 130), LV_PART_MAIN);
|
|
||||||
lv_obj_align_to(settingsScreen->sensors_labels.clock.label, rtc_time, LV_ALIGN_OUT_BOTTOM_LEFT, 0, SETTINGS_SCREEN_CATEGORY_SPACING_INNER);
|
|
||||||
_set_rtc_time_to_label(settingsScreen);
|
|
||||||
|
|
||||||
/* Let's display the magnetometer data */
|
|
||||||
lv_obj_t *magnetometer_data = lv_label_create(settingsScreen->side_screen);
|
|
||||||
lv_label_set_text_static(magnetometer_data, "Magnetometer :");
|
|
||||||
lv_obj_align_to(magnetometer_data, settingsScreen->sensors_labels.clock.label, LV_ALIGN_OUT_BOTTOM_LEFT, 0, SETTINGS_SCREEN_CATEGORY_SPACING_OUTER);
|
|
||||||
|
|
||||||
settingsScreen->sensors_labels.magnetometer.x.label = lv_label_create(settingsScreen->side_screen);
|
|
||||||
lv_obj_set_style_text_color(settingsScreen->sensors_labels.magnetometer.x.label, lv_color_make(130, 130, 130), LV_PART_MAIN);
|
|
||||||
lv_obj_align_to(settingsScreen->sensors_labels.magnetometer.x.label, magnetometer_data, LV_ALIGN_OUT_BOTTOM_LEFT, 0, 3);
|
|
||||||
|
|
||||||
settingsScreen->sensors_labels.magnetometer.y.label = lv_label_create(settingsScreen->side_screen);
|
|
||||||
lv_obj_set_style_text_color(settingsScreen->sensors_labels.magnetometer.y.label, lv_color_make(130, 130, 130), LV_PART_MAIN);
|
|
||||||
lv_obj_align_to(settingsScreen->sensors_labels.magnetometer.y.label, settingsScreen->sensors_labels.magnetometer.x.label, LV_ALIGN_OUT_BOTTOM_LEFT, 0, SETTINGS_SCREEN_CATEGORY_SPACING_INNER);
|
|
||||||
|
|
||||||
settingsScreen->sensors_labels.magnetometer.z.label = lv_label_create(settingsScreen->side_screen);
|
|
||||||
lv_obj_set_style_text_color(settingsScreen->sensors_labels.magnetometer.z.label, lv_color_make(130, 130, 130), LV_PART_MAIN);
|
|
||||||
lv_obj_align_to(settingsScreen->sensors_labels.magnetometer.z.label, settingsScreen->sensors_labels.magnetometer.y.label, LV_ALIGN_OUT_BOTTOM_LEFT, 0, SETTINGS_SCREEN_CATEGORY_SPACING_INNER);
|
|
||||||
|
|
||||||
settingsScreen->sensors_labels.magnetometer.temperature.label = lv_label_create(settingsScreen->side_screen);
|
|
||||||
lv_obj_set_style_text_color(settingsScreen->sensors_labels.magnetometer.temperature.label, lv_color_make(130, 130, 130), LV_PART_MAIN);
|
|
||||||
lv_obj_align_to(settingsScreen->sensors_labels.magnetometer.temperature.label, settingsScreen->sensors_labels.magnetometer.z.label, LV_ALIGN_OUT_BOTTOM_LEFT, 0, SETTINGS_SCREEN_CATEGORY_SPACING_INNER);
|
|
||||||
_set_magnetometer_axes_to_label(settingsScreen);
|
|
||||||
_set_magnetometer_temperature_to_label(settingsScreen);
|
|
||||||
|
|
||||||
lv_obj_update_layout(settingsScreen->sensors_labels.magnetometer.temperature.label);
|
|
||||||
|
|
||||||
lv_obj_t *magnetometer_cal_btn = lv_btn_create(settingsScreen->side_screen);
|
|
||||||
lv_obj_align(magnetometer_cal_btn, LV_ALIGN_TOP_MID, 0, lv_obj_get_y(settingsScreen->sensors_labels.magnetometer.temperature.label) + lv_obj_get_height(settingsScreen->sensors_labels.magnetometer.temperature.label) + SETTINGS_SCREEN_CATEGORY_SPACING_INNER);
|
|
||||||
|
|
||||||
lv_obj_t *magnetometer_cal_btn_label = lv_label_create(magnetometer_cal_btn);
|
|
||||||
lv_label_set_text_static(magnetometer_cal_btn_label, "Calibrate");
|
|
||||||
lv_obj_center(magnetometer_cal_btn_label);
|
|
||||||
|
|
||||||
lv_obj_update_layout(magnetometer_cal_btn);
|
|
||||||
|
|
||||||
/* Let's display the accelerometer data */
|
|
||||||
lv_obj_t *accelerometer_data = lv_label_create(settingsScreen->side_screen);
|
|
||||||
lv_label_set_text_static(accelerometer_data, "Accelerometer :");
|
|
||||||
lv_obj_align(accelerometer_data, LV_ALIGN_TOP_LEFT, 0, lv_obj_get_y(magnetometer_cal_btn) + lv_obj_get_height(magnetometer_cal_btn) + SETTINGS_SCREEN_CATEGORY_SPACING_OUTER);
|
|
||||||
|
|
||||||
settingsScreen->sensors_labels.accelerometer.x.label = lv_label_create(settingsScreen->side_screen);
|
|
||||||
lv_obj_set_style_text_color(settingsScreen->sensors_labels.accelerometer.x.label, lv_color_make(130, 130, 130), LV_PART_MAIN);
|
|
||||||
lv_obj_align_to(settingsScreen->sensors_labels.accelerometer.x.label, accelerometer_data, LV_ALIGN_OUT_BOTTOM_LEFT, 0, SETTINGS_SCREEN_CATEGORY_SPACING_INNER);
|
|
||||||
|
|
||||||
settingsScreen->sensors_labels.accelerometer.y.label = lv_label_create(settingsScreen->side_screen);
|
|
||||||
lv_obj_set_style_text_color(settingsScreen->sensors_labels.accelerometer.y.label, lv_color_make(130, 130, 130), LV_PART_MAIN);
|
|
||||||
lv_obj_align_to(settingsScreen->sensors_labels.accelerometer.y.label, settingsScreen->sensors_labels.accelerometer.x.label, LV_ALIGN_OUT_BOTTOM_LEFT, 0, SETTINGS_SCREEN_CATEGORY_SPACING_INNER);
|
|
||||||
|
|
||||||
settingsScreen->sensors_labels.accelerometer.z.label = lv_label_create(settingsScreen->side_screen);
|
|
||||||
lv_obj_set_style_text_color(settingsScreen->sensors_labels.accelerometer.z.label, lv_color_make(130, 130, 130), LV_PART_MAIN);
|
|
||||||
lv_obj_align_to(settingsScreen->sensors_labels.accelerometer.z.label, settingsScreen->sensors_labels.accelerometer.y.label, LV_ALIGN_OUT_BOTTOM_LEFT, 0, SETTINGS_SCREEN_CATEGORY_SPACING_INNER);
|
|
||||||
|
|
||||||
settingsScreen->sensors_labels.accelerometer.temperature.label = lv_label_create(settingsScreen->side_screen);
|
|
||||||
lv_obj_set_style_text_color(settingsScreen->sensors_labels.accelerometer.temperature.label, lv_color_make(130, 130, 130), LV_PART_MAIN);
|
|
||||||
lv_obj_align_to(settingsScreen->sensors_labels.accelerometer.temperature.label, settingsScreen->sensors_labels.accelerometer.z.label, LV_ALIGN_OUT_BOTTOM_LEFT, 0, SETTINGS_SCREEN_CATEGORY_SPACING_INNER);
|
|
||||||
|
|
||||||
settingsScreen->sensors_labels.accelerometer.steps.label = lv_label_create(settingsScreen->side_screen);
|
|
||||||
lv_obj_set_style_text_color(settingsScreen->sensors_labels.accelerometer.steps.label, lv_color_make(130, 130, 130), LV_PART_MAIN);
|
|
||||||
lv_obj_align_to(settingsScreen->sensors_labels.accelerometer.steps.label, settingsScreen->sensors_labels.accelerometer.temperature.label, LV_ALIGN_OUT_BOTTOM_LEFT, 0, SETTINGS_SCREEN_CATEGORY_SPACING_INNER);
|
|
||||||
_set_accelerometer_axes_to_label(settingsScreen);
|
|
||||||
_set_accelerometer_steps_and_temperature_to_label(settingsScreen);
|
|
||||||
|
|
||||||
/* Let's display the pressure sensor data */
|
|
||||||
lv_obj_t *bmp280_data = lv_label_create(settingsScreen->side_screen);
|
|
||||||
lv_label_set_text_static(bmp280_data, "Pressure &\nTemperature :");
|
|
||||||
lv_obj_align_to(bmp280_data, settingsScreen->sensors_labels.accelerometer.steps.label, LV_ALIGN_OUT_BOTTOM_LEFT, 0, SETTINGS_SCREEN_CATEGORY_SPACING_OUTER);
|
|
||||||
|
|
||||||
settingsScreen->sensors_labels.pressure.pressure.label = lv_label_create(settingsScreen->side_screen);
|
|
||||||
lv_obj_set_style_text_color(settingsScreen->sensors_labels.pressure.pressure.label, lv_color_make(130, 130, 130), LV_PART_MAIN);
|
|
||||||
lv_obj_align_to(settingsScreen->sensors_labels.pressure.pressure.label, bmp280_data, LV_ALIGN_OUT_BOTTOM_LEFT, 0, SETTINGS_SCREEN_CATEGORY_SPACING_INNER);
|
|
||||||
|
|
||||||
settingsScreen->sensors_labels.pressure.temperature.label = lv_label_create(settingsScreen->side_screen);
|
|
||||||
lv_obj_set_style_text_color(settingsScreen->sensors_labels.pressure.temperature.label, lv_color_make(130, 130, 130), LV_PART_MAIN);
|
|
||||||
lv_obj_align_to(settingsScreen->sensors_labels.pressure.temperature.label, settingsScreen->sensors_labels.pressure.pressure.label, LV_ALIGN_OUT_BOTTOM_LEFT, 0, SETTINGS_SCREEN_CATEGORY_SPACING_INNER);
|
|
||||||
_set_pressure_sensor_to_label(settingsScreen);
|
|
||||||
|
|
||||||
/* Let's display the battery voltage */
|
|
||||||
lv_obj_t *battery_label = lv_label_create(settingsScreen->side_screen);
|
|
||||||
lv_label_set_text_static(battery_label, "Battery Voltage :");
|
|
||||||
lv_obj_align_to(battery_label, settingsScreen->sensors_labels.pressure.temperature.label, LV_ALIGN_OUT_BOTTOM_LEFT, 0, SETTINGS_SCREEN_CATEGORY_SPACING_OUTER);
|
|
||||||
|
|
||||||
settingsScreen->sensors_labels.battery_voltage.label = lv_label_create(settingsScreen->side_screen);
|
|
||||||
lv_obj_set_style_text_color(settingsScreen->sensors_labels.battery_voltage.label, lv_color_make(130, 130, 130), LV_PART_MAIN);
|
|
||||||
lv_obj_align_to(settingsScreen->sensors_labels.battery_voltage.label, battery_label, LV_ALIGN_OUT_BOTTOM_LEFT, 0, SETTINGS_SCREEN_CATEGORY_SPACING_INNER);
|
|
||||||
_set_battery_voltage_to_label(settingsScreen);
|
|
||||||
|
|
||||||
/* Create and start the refresh timer */
|
|
||||||
if(settingsScreen->sensors_refresh_timer)
|
|
||||||
{
|
|
||||||
LV_LOG_ERROR("sensors_refresh_timer should be NULL here !");
|
|
||||||
lv_timer_del(settingsScreen->sensors_refresh_timer);
|
|
||||||
settingsScreen->sensors_refresh_timer = NULL;
|
|
||||||
}
|
|
||||||
settingsScreen->sensors_refresh_timer = lv_timer_create(&(sensors_refresh_timer_cb), 150, settingsScreen);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void load_language_side_screen(SettingsScreen_t *settingsScreen)
|
static void load_language_side_screen(SettingsScreen_t *settingsScreen)
|
||||||
{
|
{
|
||||||
settingsScreen->language_label = lv_label_create(settingsScreen->side_screen);
|
settingsScreen->language_label = lv_label_create(settingsScreen->side_screen);
|
||||||
lv_label_set_text_static(settingsScreen->language_label, translation_get_word(TRANSLATION_LANGUAGE_2));
|
lv_label_set_text_static(settingsScreen->language_label, translation_get_word(TRANSLATION_LANGUAGE_2));
|
||||||
|
|
||||||
lv_obj_t *language_dropdown = lv_dropdown_create(settingsScreen->side_screen);
|
lv_obj_t *language_dropdown = lv_dropdown_create(settingsScreen->side_screen);
|
||||||
lv_obj_align_to(language_dropdown, settingsScreen->language_label, LV_ALIGN_OUT_BOTTOM_LEFT, 0, SETTINGS_SCREEN_CATEGORY_SPACING_OUTER);
|
lv_obj_align_to(language_dropdown, settingsScreen->language_label, LV_ALIGN_OUT_BOTTOM_LEFT, 0, 10);
|
||||||
lv_dropdown_set_options_static(language_dropdown, language_options);
|
lv_dropdown_set_options_static(language_dropdown, language_options);
|
||||||
uint8_t language = 0;
|
uint8_t language = 0;
|
||||||
if(settingsScreen->settingsScreenAPIInterface.setLanguageSettingsCb)settingsScreen->settingsScreenAPIInterface.setLanguageSettingsCb(&language, SETTING_MODE_GET);
|
if(settingsScreen->settingsScreenAPIInterface.setLanguageSettingsCb)settingsScreen->settingsScreenAPIInterface.setLanguageSettingsCb(&language, SETTING_MODE_GET);
|
||||||
@ -860,7 +735,7 @@ static void load_about_side_screen(SettingsScreen_t *settingsScreen)
|
|||||||
|
|
||||||
lv_obj_t *firmware_label = lv_label_create(settingsScreen->side_screen);
|
lv_obj_t *firmware_label = lv_label_create(settingsScreen->side_screen);
|
||||||
lv_label_set_text_static(firmware_label, "Firmware :");
|
lv_label_set_text_static(firmware_label, "Firmware :");
|
||||||
lv_obj_align_to(firmware_label, label, LV_ALIGN_OUT_BOTTOM_LEFT, 0, SETTINGS_SCREEN_CATEGORY_SPACING_OUTER);
|
lv_obj_align_to(firmware_label, label, LV_ALIGN_OUT_BOTTOM_LEFT, 0, 10);
|
||||||
|
|
||||||
lv_obj_t *version_label = lv_label_create(settingsScreen->side_screen);
|
lv_obj_t *version_label = lv_label_create(settingsScreen->side_screen);
|
||||||
lv_label_set_text_static(version_label, FIRMWARE_VERSION);
|
lv_label_set_text_static(version_label, FIRMWARE_VERSION);
|
||||||
@ -868,56 +743,89 @@ static void load_about_side_screen(SettingsScreen_t *settingsScreen)
|
|||||||
lv_obj_align_to(version_label, firmware_label, LV_ALIGN_OUT_RIGHT_MID, 7, 0);
|
lv_obj_align_to(version_label, firmware_label, LV_ALIGN_OUT_RIGHT_MID, 7, 0);
|
||||||
|
|
||||||
lv_obj_t* compile_label = lv_label_create(settingsScreen->side_screen);
|
lv_obj_t* compile_label = lv_label_create(settingsScreen->side_screen);
|
||||||
lv_label_set_text_static(compile_label, "Compile Date :");
|
lv_label_set_text_static(compile_label, "Compile date :");
|
||||||
lv_obj_align_to(compile_label, firmware_label, LV_ALIGN_OUT_BOTTOM_LEFT, 0, SETTINGS_SCREEN_CATEGORY_SPACING_OUTER);
|
lv_obj_align_to(compile_label, firmware_label, LV_ALIGN_OUT_BOTTOM_LEFT, 0, 5);
|
||||||
|
|
||||||
lv_obj_t* compile_date_label = lv_label_create(settingsScreen->side_screen);
|
lv_obj_t* compile_date_label = lv_label_create(settingsScreen->side_screen);
|
||||||
lv_label_set_text_static(compile_date_label, FIRMWARE_COMPILATION_TIME_DATE);
|
lv_label_set_text_static(compile_date_label, FIRMWARE_COMPILATION_TIME_DATE);
|
||||||
lv_obj_set_style_text_color(compile_date_label, lv_color_make(130, 130, 130), LV_PART_MAIN);
|
lv_obj_set_style_text_color(compile_date_label, lv_color_make(130, 130, 130), LV_PART_MAIN);
|
||||||
lv_obj_align_to(compile_date_label, compile_label, LV_ALIGN_OUT_BOTTOM_LEFT, 0, SETTINGS_SCREEN_CATEGORY_SPACING_INNER);
|
lv_obj_align_to(compile_date_label, compile_label, LV_ALIGN_OUT_BOTTOM_LEFT, 0, 5);
|
||||||
|
|
||||||
/* Display other firmware component's versions */
|
lv_obj_t* rtc_time = lv_label_create(settingsScreen->side_screen);
|
||||||
lv_obj_t *freertos_label = lv_label_create(settingsScreen->side_screen);
|
lv_label_set_text_static(rtc_time, "RTC :");
|
||||||
lv_label_set_text_static(freertos_label, "FreeRTOS Version :");
|
lv_obj_align_to(rtc_time, compile_date_label, LV_ALIGN_OUT_BOTTOM_LEFT, 0, 5);
|
||||||
lv_obj_align_to(freertos_label, compile_date_label, LV_ALIGN_OUT_BOTTOM_LEFT, 0, SETTINGS_SCREEN_CATEGORY_SPACING_OUTER);
|
|
||||||
|
|
||||||
lv_obj_t *freertos_version_label = lv_label_create(settingsScreen->side_screen);
|
/* Display current time and date with refresh */
|
||||||
|
settingsScreen->currentTime.current_time_label = lv_label_create(settingsScreen->side_screen);
|
||||||
|
lv_obj_set_style_text_color(settingsScreen->currentTime.current_time_label, lv_color_make(130, 130, 130), LV_PART_MAIN);
|
||||||
|
lv_obj_align_to(settingsScreen->currentTime.current_time_label, rtc_time, LV_ALIGN_OUT_BOTTOM_LEFT, 0, 5);
|
||||||
|
_set_rtc_time_to_label(settingsScreen);
|
||||||
|
|
||||||
const char *freertos_version = default_version;
|
lv_obj_t *magnetometer_data = lv_label_create(settingsScreen->side_screen);
|
||||||
if(settingsScreen->settingsScreenAPIInterface.getComponentVersionCb)
|
lv_label_set_text_static(magnetometer_data, "Magnetometer :");
|
||||||
settingsScreen->settingsScreenAPIInterface.getComponentVersionCb(&freertos_version, COMPONENT_FREERTOS);
|
lv_obj_align_to(magnetometer_data, settingsScreen->currentTime.current_time_label, LV_ALIGN_OUT_BOTTOM_LEFT, 0, 5);
|
||||||
|
|
||||||
lv_label_set_text_static(freertos_version_label, freertos_version);
|
/* Display the magnetometer raw data with refresh */
|
||||||
|
settingsScreen->magnetometer_x.label = lv_label_create(settingsScreen->side_screen);
|
||||||
|
lv_obj_set_style_text_color(settingsScreen->magnetometer_x.label, lv_color_make(130, 130, 130), LV_PART_MAIN);
|
||||||
|
lv_obj_align_to(settingsScreen->magnetometer_x.label, magnetometer_data, LV_ALIGN_OUT_BOTTOM_LEFT, 0, 5);
|
||||||
|
|
||||||
lv_obj_set_style_text_color(freertos_version_label, lv_color_make(130, 130, 130), LV_PART_MAIN);
|
settingsScreen->magnetometer_y.label = lv_label_create(settingsScreen->side_screen);
|
||||||
lv_obj_align_to(freertos_version_label, freertos_label, LV_ALIGN_OUT_BOTTOM_LEFT, 0, SETTINGS_SCREEN_CATEGORY_SPACING_INNER);
|
lv_obj_set_style_text_color(settingsScreen->magnetometer_y.label, lv_color_make(130, 130, 130), LV_PART_MAIN);
|
||||||
|
lv_obj_align_to(settingsScreen->magnetometer_y.label, settingsScreen->magnetometer_x.label, LV_ALIGN_OUT_BOTTOM_LEFT, 0, 5);
|
||||||
|
|
||||||
lv_obj_t *lvgl_label = lv_label_create(settingsScreen->side_screen);
|
settingsScreen->magnetometer_z.label = lv_label_create(settingsScreen->side_screen);
|
||||||
lv_label_set_text_static(lvgl_label, "LVGL Version :");
|
lv_obj_set_style_text_color(settingsScreen->magnetometer_z.label, lv_color_make(130, 130, 130), LV_PART_MAIN);
|
||||||
lv_obj_align_to(lvgl_label, freertos_version_label, LV_ALIGN_OUT_BOTTOM_LEFT, 0, SETTINGS_SCREEN_CATEGORY_SPACING_OUTER);
|
lv_obj_align_to(settingsScreen->magnetometer_z.label, settingsScreen->magnetometer_y.label, LV_ALIGN_OUT_BOTTOM_LEFT, 0, 5);
|
||||||
|
|
||||||
lv_obj_t *lvgl_version_label = lv_label_create(settingsScreen->side_screen);
|
settingsScreen->magnetometer_temperature.label = lv_label_create(settingsScreen->side_screen);
|
||||||
|
lv_obj_set_style_text_color(settingsScreen->magnetometer_temperature.label, lv_color_make(130, 130, 130), LV_PART_MAIN);
|
||||||
|
lv_obj_align_to(settingsScreen->magnetometer_temperature.label, settingsScreen->magnetometer_z.label, LV_ALIGN_OUT_BOTTOM_LEFT, 0, 5);
|
||||||
|
_set_magnetometer_data_to_label(settingsScreen);
|
||||||
|
|
||||||
const char *lvgl_version = default_version;
|
lv_obj_t *bmp280_data = lv_label_create(settingsScreen->side_screen);
|
||||||
if(settingsScreen->settingsScreenAPIInterface.getComponentVersionCb)
|
lv_label_set_text_static(bmp280_data, "Pressure & temp :");
|
||||||
settingsScreen->settingsScreenAPIInterface.getComponentVersionCb(&lvgl_version, COMPONENT_LVGL);
|
lv_obj_align_to(bmp280_data, settingsScreen->magnetometer_temperature.label, LV_ALIGN_OUT_BOTTOM_LEFT, 0, 5);
|
||||||
|
|
||||||
lv_label_set_text_static(lvgl_version_label, lvgl_version);
|
/* Display pressure and temperature sensor data with refresh */
|
||||||
|
settingsScreen->bmp280_pressure.label = lv_label_create(settingsScreen->side_screen);
|
||||||
|
lv_obj_set_style_text_color(settingsScreen->bmp280_pressure.label, lv_color_make(130, 130, 130), LV_PART_MAIN);
|
||||||
|
lv_obj_align_to(settingsScreen->bmp280_pressure.label, bmp280_data, LV_ALIGN_OUT_BOTTOM_LEFT, 0, 5);
|
||||||
|
|
||||||
lv_obj_set_style_text_color(lvgl_version_label, lv_color_make(130, 130, 130), LV_PART_MAIN);
|
settingsScreen->bmp280_temperature.label = lv_label_create(settingsScreen->side_screen);
|
||||||
lv_obj_align_to(lvgl_version_label, lvgl_label, LV_ALIGN_OUT_BOTTOM_LEFT, 0, SETTINGS_SCREEN_CATEGORY_SPACING_INNER);
|
lv_obj_set_style_text_color(settingsScreen->bmp280_temperature.label, lv_color_make(130, 130, 130), LV_PART_MAIN);
|
||||||
|
lv_obj_align_to(settingsScreen->bmp280_temperature.label, settingsScreen->bmp280_pressure.label, LV_ALIGN_OUT_BOTTOM_LEFT, 0, 5);
|
||||||
|
_set_bmp280_data_to_label(settingsScreen);
|
||||||
|
|
||||||
|
lv_obj_t *battery_label = lv_label_create(settingsScreen->side_screen);
|
||||||
|
lv_label_set_text_static(battery_label, "Battery Voltage :");
|
||||||
|
lv_obj_align_to(battery_label, settingsScreen->bmp280_temperature.label, LV_ALIGN_OUT_BOTTOM_LEFT, 0, 5);
|
||||||
|
|
||||||
|
settingsScreen->batteryVoltage.batteryVoltageLabel = lv_label_create(settingsScreen->side_screen);
|
||||||
|
_set_battery_voltage_to_label(settingsScreen);
|
||||||
|
lv_obj_set_style_text_color(settingsScreen->batteryVoltage.batteryVoltageLabel, lv_color_make(130, 130, 130), LV_PART_MAIN);
|
||||||
|
lv_obj_align_to(settingsScreen->batteryVoltage.batteryVoltageLabel, battery_label, LV_ALIGN_OUT_BOTTOM_LEFT, 0, 5);
|
||||||
|
|
||||||
label = lv_label_create(settingsScreen->side_screen);
|
label = lv_label_create(settingsScreen->side_screen);
|
||||||
lv_label_set_text_static(label, "Factory Reset :");
|
lv_label_set_text_static(label, "Factory Reset :");
|
||||||
lv_obj_align_to(label, lvgl_version_label, LV_ALIGN_OUT_BOTTOM_LEFT, 0, SETTINGS_SCREEN_CATEGORY_SPACING_OUTER);
|
lv_obj_align_to(label, settingsScreen->batteryVoltage.batteryVoltageLabel, LV_ALIGN_OUT_BOTTOM_LEFT, 0, 5);
|
||||||
|
|
||||||
lv_obj_t *factory_rst_btn = lv_btn_create(settingsScreen->side_screen);
|
lv_obj_t *factory_rst_btn = lv_btn_create(settingsScreen->side_screen);
|
||||||
lv_obj_align_to(factory_rst_btn, label, LV_ALIGN_OUT_BOTTOM_MID, 0, SETTINGS_SCREEN_CATEGORY_SPACING_OUTER);
|
lv_obj_align_to(factory_rst_btn, label, LV_ALIGN_OUT_BOTTOM_MID, 0, 5);
|
||||||
lv_obj_add_event_cb(factory_rst_btn, &(factory_reset_cb), LV_EVENT_CLICKED, settingsScreen);
|
lv_obj_add_event_cb(factory_rst_btn, &(factory_reset_cb), LV_EVENT_CLICKED, settingsScreen);
|
||||||
|
|
||||||
label = lv_label_create(factory_rst_btn);
|
label = lv_label_create(factory_rst_btn);
|
||||||
lv_label_set_text_static(label, "Reset");
|
lv_label_set_text_static(label, "Reset");
|
||||||
lv_obj_center(label);
|
lv_obj_center(label);
|
||||||
|
|
||||||
|
/* Create and start the refresh timer */
|
||||||
|
if(settingsScreen->about_refresh_timer)
|
||||||
|
{
|
||||||
|
LV_LOG_ERROR("about_refresh_timer should be NULL here !");
|
||||||
|
lv_timer_del(settingsScreen->about_refresh_timer);
|
||||||
|
settingsScreen->about_refresh_timer = NULL;
|
||||||
|
}
|
||||||
|
settingsScreen->about_refresh_timer = lv_timer_create(&(about_refresh_timer_cb), 150, settingsScreen);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void menu_list_item_event_handler(lv_event_t * e)
|
static void menu_list_item_event_handler(lv_event_t * e)
|
||||||
@ -1010,7 +918,6 @@ void settings_screen_create(SettingsScreen_t * const settingsScreen)
|
|||||||
lv_obj_set_style_radius(settingsScreen->side_screen, 0, LV_PART_MAIN);
|
lv_obj_set_style_radius(settingsScreen->side_screen, 0, LV_PART_MAIN);
|
||||||
lv_obj_set_style_border_width(settingsScreen->side_screen, 0, LV_PART_MAIN);
|
lv_obj_set_style_border_width(settingsScreen->side_screen, 0, LV_PART_MAIN);
|
||||||
lv_obj_set_style_pad_left(settingsScreen->side_screen, 5, LV_PART_MAIN);
|
lv_obj_set_style_pad_left(settingsScreen->side_screen, 5, LV_PART_MAIN);
|
||||||
// Add some padding to make the settings page scroll longer
|
|
||||||
lv_obj_set_style_pad_bottom(settingsScreen->side_screen, 70, LV_PART_MAIN);
|
lv_obj_set_style_pad_bottom(settingsScreen->side_screen, 70, LV_PART_MAIN);
|
||||||
lv_obj_set_scroll_dir(settingsScreen->side_screen, LV_DIR_VER);
|
lv_obj_set_scroll_dir(settingsScreen->side_screen, LV_DIR_VER);
|
||||||
|
|
||||||
@ -1019,7 +926,6 @@ void settings_screen_create(SettingsScreen_t * const settingsScreen)
|
|||||||
settingsScreen->display_item = add_menu_list_item(menu_list, translation_get_word(TRANSLATION_DISPLAY), &(menu_list_item_event_handler), settingsScreen, SETTINGS_SCREEN_CATEGORY_DISPLAY);
|
settingsScreen->display_item = add_menu_list_item(menu_list, translation_get_word(TRANSLATION_DISPLAY), &(menu_list_item_event_handler), settingsScreen, SETTINGS_SCREEN_CATEGORY_DISPLAY);
|
||||||
settingsScreen->notifications_item = add_menu_list_item(menu_list, translation_get_word(TRANSLATION_NOTIFICATIONS), &(menu_list_item_event_handler), settingsScreen, SETTINGS_SCREEN_CATEGORY_NOTIFICATION);
|
settingsScreen->notifications_item = add_menu_list_item(menu_list, translation_get_word(TRANSLATION_NOTIFICATIONS), &(menu_list_item_event_handler), settingsScreen, SETTINGS_SCREEN_CATEGORY_NOTIFICATION);
|
||||||
settingsScreen->connectivity_item = add_menu_list_item(menu_list, translation_get_word(TRANSLATION_CONNECTIVITY), &(menu_list_item_event_handler), settingsScreen, SETTINGS_SCREEN_CATEGORY_CONNECTIVITY);
|
settingsScreen->connectivity_item = add_menu_list_item(menu_list, translation_get_word(TRANSLATION_CONNECTIVITY), &(menu_list_item_event_handler), settingsScreen, SETTINGS_SCREEN_CATEGORY_CONNECTIVITY);
|
||||||
settingsScreen->sensors_item = add_menu_list_item(menu_list, translation_get_word(TRANSLATION_SENSORS), &(menu_list_item_event_handler), settingsScreen, SETTINGS_SCREEN_CATEGORY_SENSORS);
|
|
||||||
settingsScreen->language_item = add_menu_list_item(menu_list, translation_get_word(TRANSLATION_LANGUAGE), &(menu_list_item_event_handler), settingsScreen, SETTINGS_SCREEN_CATEGORY_LANGUAGE);
|
settingsScreen->language_item = add_menu_list_item(menu_list, translation_get_word(TRANSLATION_LANGUAGE), &(menu_list_item_event_handler), settingsScreen, SETTINGS_SCREEN_CATEGORY_LANGUAGE);
|
||||||
settingsScreen->about_item = add_menu_list_item(menu_list, translation_get_word(TRANSLATION_ABOUT), &(menu_list_item_event_handler), settingsScreen, SETTINGS_SCREEN_CATEGORY_ABOUT);
|
settingsScreen->about_item = add_menu_list_item(menu_list, translation_get_word(TRANSLATION_ABOUT), &(menu_list_item_event_handler), settingsScreen, SETTINGS_SCREEN_CATEGORY_ABOUT);
|
||||||
|
|
||||||
@ -1053,7 +959,7 @@ void settings_screen_destroy(SettingsScreen_t * const settingsScreen)
|
|||||||
settingsScreen->month_roller = NULL;
|
settingsScreen->month_roller = NULL;
|
||||||
settingsScreen->year_roller = NULL;
|
settingsScreen->year_roller = NULL;
|
||||||
settingsScreen->display = NULL;
|
settingsScreen->display = NULL;
|
||||||
settingsScreen->sensors_refresh_timer = NULL;
|
settingsScreen->about_refresh_timer = NULL;
|
||||||
settingsScreen->last_selected_item = NULL;
|
settingsScreen->last_selected_item = NULL;
|
||||||
settingsScreen->language_label = NULL;
|
settingsScreen->language_label = NULL;
|
||||||
}
|
}
|
||||||
@ -1062,10 +968,10 @@ static void _simulate_side_screen_item_click(SettingsScreen_t * const settingsSc
|
|||||||
{
|
{
|
||||||
if(settingsScreen->last_selected_item == item) return;
|
if(settingsScreen->last_selected_item == item) return;
|
||||||
|
|
||||||
if(settingsScreen->last_selected_item == settingsScreen->sensors_item)
|
if(settingsScreen->last_selected_item == settingsScreen->about_item)
|
||||||
{
|
{
|
||||||
lv_timer_del(settingsScreen->sensors_refresh_timer);
|
lv_timer_del(settingsScreen->about_refresh_timer);
|
||||||
settingsScreen->sensors_refresh_timer = NULL;
|
settingsScreen->about_refresh_timer = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Updating the background of the selected category
|
// Updating the background of the selected category
|
||||||
@ -1111,10 +1017,6 @@ static void _simulate_side_screen_item_click(SettingsScreen_t * const settingsSc
|
|||||||
{
|
{
|
||||||
load_connectivity_side_screen(settingsScreen);
|
load_connectivity_side_screen(settingsScreen);
|
||||||
}
|
}
|
||||||
else if(item == settingsScreen->sensors_item)
|
|
||||||
{
|
|
||||||
load_sensors_side_screen(settingsScreen);
|
|
||||||
}
|
|
||||||
else if(item == settingsScreen->language_item)
|
else if(item == settingsScreen->language_item)
|
||||||
{
|
{
|
||||||
load_language_side_screen(settingsScreen);
|
load_language_side_screen(settingsScreen);
|
||||||
@ -1127,130 +1029,56 @@ static void _simulate_side_screen_item_click(SettingsScreen_t * const settingsSc
|
|||||||
|
|
||||||
static void _set_rtc_time_to_label(SettingsScreen_t * const settingsScreen)
|
static void _set_rtc_time_to_label(SettingsScreen_t * const settingsScreen)
|
||||||
{
|
{
|
||||||
uint8_t hour = 0U, minute = 0U, second = 0U, day = 0U, month = 0U, year = 0U;
|
uint8_t hour = 0, minute = 0, second = 0, day = 0, month = 0, year = 0;
|
||||||
if(settingsScreen->settingsScreenAPIInterface.setTimeSettingsCb)
|
if(settingsScreen->settingsScreenAPIInterface.setTimeSettingsCb)
|
||||||
settingsScreen->settingsScreenAPIInterface.setTimeSettingsCb(&hour, &minute, &second, &day, &month, &year, SETTING_MODE_GET);
|
settingsScreen->settingsScreenAPIInterface.setTimeSettingsCb(&hour, &minute, &second, &day, &month, &year, SETTING_MODE_GET);
|
||||||
snprintf(settingsScreen->sensors_labels.clock.text,
|
sprintf(settingsScreen->currentTime.current_time_text, "%s%u:%s%u:%s%u %s%u/%s%u/%u",
|
||||||
sizeof(settingsScreen->sensors_labels.clock.text)-1, "%s%u:%s%u:%s%u %s%u/%s%u/%u",
|
|
||||||
hour < 10 ? "0":"", hour,
|
hour < 10 ? "0":"", hour,
|
||||||
minute < 10 ? "0":"", minute,
|
minute < 10 ? "0":"", minute,
|
||||||
second < 10 ? "0":"", second,
|
second < 10 ? "0":"", second,
|
||||||
day < 10 ? "0":"", day,
|
day < 10 ? "0":"", day,
|
||||||
month + 1 < 10 ? "0":"", month + 1,
|
month + 1 < 10 ? "0":"", month + 1,
|
||||||
year+1900);
|
year+1900);
|
||||||
|
lv_label_set_text_static(settingsScreen->currentTime.current_time_label, settingsScreen->currentTime.current_time_text);
|
||||||
lv_label_set_text_static(settingsScreen->sensors_labels.clock.label, settingsScreen->sensors_labels.clock.text);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void _set_battery_voltage_to_label(SettingsScreen_t * const settingsScreen)
|
static void _set_battery_voltage_to_label(SettingsScreen_t * const settingsScreen)
|
||||||
{
|
{
|
||||||
uint16_t voltage = 0U;
|
uint16_t voltage = 0;
|
||||||
if(settingsScreen->settingsScreenAPIInterface.getBatteryVoltageCb) settingsScreen->settingsScreenAPIInterface.getBatteryVoltageCb(&voltage);
|
if(settingsScreen->settingsScreenAPIInterface.getBatteryVoltageCb) settingsScreen->settingsScreenAPIInterface.getBatteryVoltageCb(&voltage);
|
||||||
|
sprintf(settingsScreen->batteryVoltage.batteryVoltageText, "%u mV", voltage);
|
||||||
snprintf(settingsScreen->sensors_labels.battery_voltage.text,
|
lv_label_set_text_static(settingsScreen->batteryVoltage.batteryVoltageLabel, settingsScreen->batteryVoltage.batteryVoltageText);
|
||||||
sizeof(settingsScreen->sensors_labels.battery_voltage.text)-1, "%u mV", voltage);
|
|
||||||
|
|
||||||
lv_label_set_text_static(settingsScreen->sensors_labels.battery_voltage.label, settingsScreen->sensors_labels.battery_voltage.text);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void _set_magnetometer_axes_to_label(SettingsScreen_t * const settingsScreen)
|
static void _set_magnetometer_data_to_label(SettingsScreen_t * const settingsScreen)
|
||||||
{
|
{
|
||||||
int16_t field_x = 0, field_y = 0, field_z = 0;
|
int16_t field_x = 0, field_y = 0, field_z = 0;
|
||||||
|
float temperature = 0.0;
|
||||||
|
if(settingsScreen->settingsScreenAPIInterface.getMagnetometerRawDataCb) settingsScreen->settingsScreenAPIInterface.getMagnetometerRawDataCb(&field_x, &field_y, &field_z, &temperature);
|
||||||
|
|
||||||
if(settingsScreen->settingsScreenAPIInterface.getMagnetometerRawDataCb)
|
sprintf(settingsScreen->magnetometer_x.text, "x: %d", field_x);
|
||||||
settingsScreen->settingsScreenAPIInterface.getMagnetometerRawDataCb(&field_x,
|
lv_label_set_text_static(settingsScreen->magnetometer_x.label, settingsScreen->magnetometer_x.text);
|
||||||
&field_y,
|
|
||||||
&field_z,
|
|
||||||
NULL);
|
|
||||||
snprintf(settingsScreen->sensors_labels.magnetometer.x.text,
|
|
||||||
sizeof(settingsScreen->sensors_labels.magnetometer.x.text)-1,
|
|
||||||
"x: %d", field_x);
|
|
||||||
snprintf(settingsScreen->sensors_labels.magnetometer.y.text,
|
|
||||||
sizeof(settingsScreen->sensors_labels.magnetometer.y.text)-1,
|
|
||||||
"y: %d", field_y);
|
|
||||||
snprintf(settingsScreen->sensors_labels.magnetometer.z.text,
|
|
||||||
sizeof(settingsScreen->sensors_labels.magnetometer.z.text)-1,
|
|
||||||
"z: %d", field_z);
|
|
||||||
|
|
||||||
lv_label_set_text_static(settingsScreen->sensors_labels.magnetometer.x.label, settingsScreen->sensors_labels.magnetometer.x.text);
|
sprintf(settingsScreen->magnetometer_y.text, "y: %d", field_y);
|
||||||
lv_label_set_text_static(settingsScreen->sensors_labels.magnetometer.y.label, settingsScreen->sensors_labels.magnetometer.y.text);
|
lv_label_set_text_static(settingsScreen->magnetometer_y.label, settingsScreen->magnetometer_y.text);
|
||||||
lv_label_set_text_static(settingsScreen->sensors_labels.magnetometer.z.label, settingsScreen->sensors_labels.magnetometer.z.text);
|
|
||||||
|
sprintf(settingsScreen->magnetometer_z.text, "z: %d", field_z);
|
||||||
|
lv_label_set_text_static(settingsScreen->magnetometer_z.label, settingsScreen->magnetometer_z.text);
|
||||||
|
|
||||||
|
sprintf(settingsScreen->magnetometer_temperature.text, "%.2f °C", temperature);
|
||||||
|
lv_label_set_text_static(settingsScreen->magnetometer_temperature.label, settingsScreen->magnetometer_temperature.text);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void _set_magnetometer_temperature_to_label(SettingsScreen_t * const settingsScreen)
|
static void _set_bmp280_data_to_label(SettingsScreen_t * const settingsScreen)
|
||||||
{
|
{
|
||||||
float temperature = 0.0f;
|
float pressure = 0.0, temperature = 0.0;
|
||||||
|
|
||||||
if(settingsScreen->settingsScreenAPIInterface.getMagnetometerRawDataCb)
|
|
||||||
settingsScreen->settingsScreenAPIInterface.getMagnetometerRawDataCb(NULL,
|
|
||||||
NULL,
|
|
||||||
NULL,
|
|
||||||
&temperature);
|
|
||||||
|
|
||||||
snprintf(settingsScreen->sensors_labels.magnetometer.temperature.text,
|
|
||||||
sizeof(settingsScreen->sensors_labels.magnetometer.temperature.text)-1,
|
|
||||||
"%.2f °C", temperature);
|
|
||||||
|
|
||||||
lv_label_set_text_static(settingsScreen->sensors_labels.magnetometer.temperature.label, settingsScreen->sensors_labels.magnetometer.temperature.text);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void _set_accelerometer_axes_to_label(SettingsScreen_t * const settingsScreen)
|
|
||||||
{
|
|
||||||
int16_t accel_x = 0, accel_y = 0, accel_z = 0;
|
|
||||||
|
|
||||||
if(settingsScreen->settingsScreenAPIInterface.getAccelerometerRawDataCb)
|
|
||||||
settingsScreen->settingsScreenAPIInterface.getAccelerometerRawDataCb(&accel_x,
|
|
||||||
&accel_y,
|
|
||||||
&accel_z,
|
|
||||||
NULL,
|
|
||||||
NULL);
|
|
||||||
snprintf(settingsScreen->sensors_labels.accelerometer.x.text,
|
|
||||||
sizeof(settingsScreen->sensors_labels.accelerometer.x.text)-1,
|
|
||||||
"x: %d", accel_x);
|
|
||||||
snprintf(settingsScreen->sensors_labels.accelerometer.y.text,
|
|
||||||
sizeof(settingsScreen->sensors_labels.accelerometer.y.text)-1,
|
|
||||||
"y: %d", accel_y);
|
|
||||||
snprintf(settingsScreen->sensors_labels.accelerometer.z.text,
|
|
||||||
sizeof(settingsScreen->sensors_labels.accelerometer.z.text)-1,
|
|
||||||
"z: %d", accel_z);
|
|
||||||
|
|
||||||
lv_label_set_text_static(settingsScreen->sensors_labels.accelerometer.x.label, settingsScreen->sensors_labels.accelerometer.x.text);
|
|
||||||
lv_label_set_text_static(settingsScreen->sensors_labels.accelerometer.y.label, settingsScreen->sensors_labels.accelerometer.y.text);
|
|
||||||
lv_label_set_text_static(settingsScreen->sensors_labels.accelerometer.z.label, settingsScreen->sensors_labels.accelerometer.z.text);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void _set_accelerometer_steps_and_temperature_to_label(SettingsScreen_t * const settingsScreen)
|
|
||||||
{
|
|
||||||
float temperature = 0.0F;
|
|
||||||
uint32_t steps = 0U;
|
|
||||||
|
|
||||||
if(settingsScreen->settingsScreenAPIInterface.getAccelerometerRawDataCb)
|
|
||||||
settingsScreen->settingsScreenAPIInterface.getAccelerometerRawDataCb(NULL,
|
|
||||||
NULL,
|
|
||||||
NULL,
|
|
||||||
&temperature,
|
|
||||||
&steps);
|
|
||||||
snprintf(settingsScreen->sensors_labels.accelerometer.temperature.text,
|
|
||||||
sizeof(settingsScreen->sensors_labels.accelerometer.temperature.text)-1,
|
|
||||||
"%.2f °C", temperature);
|
|
||||||
snprintf(settingsScreen->sensors_labels.accelerometer.steps.text,
|
|
||||||
sizeof(settingsScreen->sensors_labels.accelerometer.steps.text)-1,
|
|
||||||
"%s: %u", "steps", steps);
|
|
||||||
|
|
||||||
lv_label_set_text_static(settingsScreen->sensors_labels.accelerometer.temperature.label, settingsScreen->sensors_labels.accelerometer.temperature.text);
|
|
||||||
lv_label_set_text_static(settingsScreen->sensors_labels.accelerometer.steps.label, settingsScreen->sensors_labels.accelerometer.steps.text);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void _set_pressure_sensor_to_label(SettingsScreen_t * const settingsScreen)
|
|
||||||
{
|
|
||||||
float pressure = 0.0F, temperature = 0.0F;
|
|
||||||
if(settingsScreen->settingsScreenAPIInterface.getBMP280DataCb) settingsScreen->settingsScreenAPIInterface.getBMP280DataCb(&temperature, &pressure);
|
if(settingsScreen->settingsScreenAPIInterface.getBMP280DataCb) settingsScreen->settingsScreenAPIInterface.getBMP280DataCb(&temperature, &pressure);
|
||||||
|
|
||||||
snprintf(settingsScreen->sensors_labels.pressure.pressure.text, sizeof(settingsScreen->sensors_labels.pressure.pressure.text)-1, "%.2f hPa", pressure);
|
sprintf(settingsScreen->bmp280_pressure.text, "%.2f hPa", pressure);
|
||||||
snprintf(settingsScreen->sensors_labels.pressure.temperature.text, sizeof(settingsScreen->sensors_labels.pressure.temperature.text)-1, "%.2f °C", temperature);
|
lv_label_set_text_static(settingsScreen->bmp280_pressure.label, settingsScreen->bmp280_pressure.text);
|
||||||
|
|
||||||
lv_label_set_text_static(settingsScreen->sensors_labels.pressure.pressure.label, settingsScreen->sensors_labels.pressure.pressure.text);
|
sprintf(settingsScreen->bmp280_temperature.text, "%.2f °C", temperature);
|
||||||
lv_label_set_text_static(settingsScreen->sensors_labels.pressure.temperature.label, settingsScreen->sensors_labels.pressure.temperature.text);
|
lv_label_set_text_static(settingsScreen->bmp280_temperature.label, settingsScreen->bmp280_temperature.text);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void _enable_time_and_date_rollers(bool enabled, SettingsScreen_t * const settingsScreen)
|
static void _enable_time_and_date_rollers(bool enabled, SettingsScreen_t * const settingsScreen)
|
||||||
@ -1316,7 +1144,7 @@ static void update_menu_list_item_text(lv_obj_t *menu_list_item, const char *tex
|
|||||||
|
|
||||||
static void _show_ble_pairing_key(SettingsScreen_t * const settingsScreen, bool show)
|
static void _show_ble_pairing_key(SettingsScreen_t * const settingsScreen, bool show)
|
||||||
{
|
{
|
||||||
lv_obj_align_to(settingsScreen->ble_pairing_label, settingsScreen->ble_switch, LV_ALIGN_OUT_BOTTOM_LEFT, 0, SETTINGS_SCREEN_CATEGORY_SPACING_OUTER);
|
lv_obj_align_to(settingsScreen->ble_pairing_label, settingsScreen->ble_switch, LV_ALIGN_OUT_BOTTOM_LEFT, 0, 5);
|
||||||
if(show)
|
if(show)
|
||||||
{
|
{
|
||||||
uint32_t pairing_key = 0;
|
uint32_t pairing_key = 0;
|
||||||
@ -1324,7 +1152,7 @@ static void _show_ble_pairing_key(SettingsScreen_t * const settingsScreen, bool
|
|||||||
sprintf(settingsScreen->ble_pairing_key.text, "%u", pairing_key);
|
sprintf(settingsScreen->ble_pairing_key.text, "%u", pairing_key);
|
||||||
|
|
||||||
lv_label_set_text_static(settingsScreen->ble_pairing_key.label, settingsScreen->ble_pairing_key.text);
|
lv_label_set_text_static(settingsScreen->ble_pairing_key.label, settingsScreen->ble_pairing_key.text);
|
||||||
lv_obj_align_to(settingsScreen->ble_dev_name_label, settingsScreen->ble_pairing_key.label, LV_ALIGN_OUT_BOTTOM_LEFT, 0, SETTINGS_SCREEN_CATEGORY_SPACING_OUTER);
|
lv_obj_align_to(settingsScreen->ble_dev_name_label, settingsScreen->ble_pairing_key.label, LV_ALIGN_OUT_BOTTOM_LEFT, 0, 5);
|
||||||
lv_obj_clear_flag(settingsScreen->ble_pairing_label, LV_OBJ_FLAG_HIDDEN);
|
lv_obj_clear_flag(settingsScreen->ble_pairing_label, LV_OBJ_FLAG_HIDDEN);
|
||||||
lv_obj_clear_flag(settingsScreen->ble_pairing_key.label, LV_OBJ_FLAG_HIDDEN);
|
lv_obj_clear_flag(settingsScreen->ble_pairing_key.label, LV_OBJ_FLAG_HIDDEN);
|
||||||
}
|
}
|
||||||
@ -1332,12 +1160,12 @@ static void _show_ble_pairing_key(SettingsScreen_t * const settingsScreen, bool
|
|||||||
{
|
{
|
||||||
lv_obj_add_flag(settingsScreen->ble_pairing_key.label, LV_OBJ_FLAG_HIDDEN);
|
lv_obj_add_flag(settingsScreen->ble_pairing_key.label, LV_OBJ_FLAG_HIDDEN);
|
||||||
lv_obj_add_flag(settingsScreen->ble_pairing_label, LV_OBJ_FLAG_HIDDEN);
|
lv_obj_add_flag(settingsScreen->ble_pairing_label, LV_OBJ_FLAG_HIDDEN);
|
||||||
lv_obj_align_to(settingsScreen->ble_dev_name_label, settingsScreen->ble_switch, LV_ALIGN_OUT_BOTTOM_LEFT, 0, SETTINGS_SCREEN_CATEGORY_SPACING_OUTER);
|
lv_obj_align_to(settingsScreen->ble_dev_name_label, settingsScreen->ble_switch, LV_ALIGN_OUT_BOTTOM_LEFT, 0, 5);
|
||||||
}
|
}
|
||||||
|
|
||||||
lv_obj_align_to(settingsScreen->ble_dev_name_value, settingsScreen->ble_dev_name_label, LV_ALIGN_OUT_BOTTOM_LEFT, 0, SETTINGS_SCREEN_CATEGORY_SPACING_INNER);
|
lv_obj_align_to(settingsScreen->ble_dev_name_value, settingsScreen->ble_dev_name_label, LV_ALIGN_OUT_BOTTOM_LEFT, 0, 5);
|
||||||
lv_obj_align_to(settingsScreen->ble_dev_mac_label, settingsScreen->ble_dev_name_value, LV_ALIGN_OUT_BOTTOM_LEFT, 0, SETTINGS_SCREEN_CATEGORY_SPACING_OUTER);
|
lv_obj_align_to(settingsScreen->ble_dev_mac_label, settingsScreen->ble_dev_name_value, LV_ALIGN_OUT_BOTTOM_LEFT, 0, 5);
|
||||||
lv_obj_align_to(settingsScreen->ble_mac_addr.label, settingsScreen->ble_dev_mac_label, LV_ALIGN_OUT_BOTTOM_LEFT, 0, SETTINGS_SCREEN_CATEGORY_SPACING_INNER);
|
lv_obj_align_to(settingsScreen->ble_mac_addr.label, settingsScreen->ble_dev_mac_label, LV_ALIGN_OUT_BOTTOM_LEFT, 0, 5);
|
||||||
lv_obj_align_to(settingsScreen->wifi_switch, settingsScreen->ble_mac_addr.label, LV_ALIGN_OUT_BOTTOM_LEFT, 0, SETTINGS_SCREEN_CATEGORY_SPACING_OUTER);
|
lv_obj_align_to(settingsScreen->wifi_switch, settingsScreen->ble_mac_addr.label, LV_ALIGN_OUT_BOTTOM_LEFT, 0, 10);
|
||||||
lv_obj_align_to(settingsScreen->wifi_label, settingsScreen->wifi_switch, LV_ALIGN_OUT_RIGHT_MID, 10, 0);
|
lv_obj_align_to(settingsScreen->wifi_label, settingsScreen->wifi_switch, LV_ALIGN_OUT_RIGHT_MID, 10, 0);
|
||||||
}
|
}
|
||||||
|
@ -9,12 +9,6 @@ typedef enum SettingMode
|
|||||||
SETTING_MODE_SET
|
SETTING_MODE_SET
|
||||||
} SettingMode_e;
|
} SettingMode_e;
|
||||||
|
|
||||||
typedef enum ComponentVersion
|
|
||||||
{
|
|
||||||
COMPONENT_FREERTOS = 0,
|
|
||||||
COMPONENT_LVGL
|
|
||||||
} ComponentVersion_e;
|
|
||||||
|
|
||||||
typedef struct SettingsScreenAPIInterface
|
typedef struct SettingsScreenAPIInterface
|
||||||
{
|
{
|
||||||
void (*setAutomaticTimeSettingsCb)(bool *enabled, SettingMode_e mode);
|
void (*setAutomaticTimeSettingsCb)(bool *enabled, SettingMode_e mode);
|
||||||
@ -40,9 +34,7 @@ typedef struct SettingsScreenAPIInterface
|
|||||||
void (*getBLEDevicePairingKeyCb)(uint32_t *pairing_key);
|
void (*getBLEDevicePairingKeyCb)(uint32_t *pairing_key);
|
||||||
void (*getBatteryVoltageCb)(uint16_t *battery_voltage);
|
void (*getBatteryVoltageCb)(uint16_t *battery_voltage);
|
||||||
void (*getMagnetometerRawDataCb)(int16_t *field_x, int16_t *field_y, int16_t *field_z, float *temperature);
|
void (*getMagnetometerRawDataCb)(int16_t *field_x, int16_t *field_y, int16_t *field_z, float *temperature);
|
||||||
void (*getAccelerometerRawDataCb)(int16_t *accel_x, int16_t *accel_y, int16_t *accel_z, float *temperature, uint32_t *step_count);
|
|
||||||
void (*getBMP280DataCb)(float *temperature, float *pressure);
|
void (*getBMP280DataCb)(float *temperature, float *pressure);
|
||||||
void (*getComponentVersionCb)(const char **version, ComponentVersion_e component);
|
|
||||||
void (*saveSettingsCb)(void);
|
void (*saveSettingsCb)(void);
|
||||||
void (*factoryResetCb)(void);
|
void (*factoryResetCb)(void);
|
||||||
} SettingsScreenAPIInterface_t;
|
} SettingsScreenAPIInterface_t;
|
||||||
@ -59,7 +51,6 @@ typedef enum SettingsScreenCategory
|
|||||||
SETTINGS_SCREEN_CATEGORY_DISPLAY,
|
SETTINGS_SCREEN_CATEGORY_DISPLAY,
|
||||||
SETTINGS_SCREEN_CATEGORY_NOTIFICATION,
|
SETTINGS_SCREEN_CATEGORY_NOTIFICATION,
|
||||||
SETTINGS_SCREEN_CATEGORY_CONNECTIVITY,
|
SETTINGS_SCREEN_CATEGORY_CONNECTIVITY,
|
||||||
SETTINGS_SCREEN_CATEGORY_SENSORS,
|
|
||||||
SETTINGS_SCREEN_CATEGORY_LANGUAGE,
|
SETTINGS_SCREEN_CATEGORY_LANGUAGE,
|
||||||
SETTINGS_SCREEN_CATEGORY_ABOUT,
|
SETTINGS_SCREEN_CATEGORY_ABOUT,
|
||||||
} SettingsScreenCategory_e;
|
} SettingsScreenCategory_e;
|
||||||
@ -75,7 +66,6 @@ typedef struct SettingsScreen
|
|||||||
lv_obj_t *display_item;
|
lv_obj_t *display_item;
|
||||||
lv_obj_t *notifications_item;
|
lv_obj_t *notifications_item;
|
||||||
lv_obj_t *connectivity_item;
|
lv_obj_t *connectivity_item;
|
||||||
lv_obj_t *sensors_item;
|
|
||||||
lv_obj_t *language_item;
|
lv_obj_t *language_item;
|
||||||
lv_obj_t *about_item;
|
lv_obj_t *about_item;
|
||||||
/* Remember the last clicked item needed for the background color logic */
|
/* Remember the last clicked item needed for the background color logic */
|
||||||
@ -103,63 +93,27 @@ typedef struct SettingsScreen
|
|||||||
|
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
struct
|
lv_obj_t *current_time_label;
|
||||||
{
|
char current_time_text[20];
|
||||||
lv_obj_t *label;
|
} currentTime;
|
||||||
char text[20];
|
|
||||||
} clock;
|
|
||||||
|
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
|
lv_obj_t *batteryVoltageLabel;
|
||||||
|
char batteryVoltageText[8];
|
||||||
|
} batteryVoltage;
|
||||||
|
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
lv_obj_t *label;
|
lv_obj_t *label;
|
||||||
char text[11];
|
char text[11];
|
||||||
} x, y, z, temperature;
|
} magnetometer_x, magnetometer_y, magnetometer_z, magnetometer_temperature, bmp280_temperature;
|
||||||
} magnetometer;
|
|
||||||
|
|
||||||
struct
|
|
||||||
{
|
|
||||||
struct
|
|
||||||
{
|
|
||||||
lv_obj_t *label;
|
|
||||||
char text[11];
|
|
||||||
} x, y, z, temperature;
|
|
||||||
|
|
||||||
struct
|
|
||||||
{
|
|
||||||
lv_obj_t *label;
|
|
||||||
char text[18];
|
|
||||||
} steps;
|
|
||||||
} accelerometer;
|
|
||||||
|
|
||||||
struct
|
|
||||||
{
|
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
lv_obj_t *label;
|
lv_obj_t *label;
|
||||||
char text[13];
|
char text[13];
|
||||||
} pressure;
|
} bmp280_pressure;
|
||||||
|
|
||||||
struct
|
|
||||||
{
|
|
||||||
lv_obj_t *label;
|
|
||||||
char text[11];
|
|
||||||
} temperature;
|
|
||||||
} pressure;
|
|
||||||
|
|
||||||
struct
|
|
||||||
{
|
|
||||||
lv_obj_t *label;
|
|
||||||
char text[8];
|
|
||||||
} battery_voltage;
|
|
||||||
} sensors_labels;
|
|
||||||
|
|
||||||
struct
|
|
||||||
{
|
|
||||||
lv_obj_t *current_time_label;
|
|
||||||
char current_time_text[20];
|
|
||||||
} currentTime;
|
|
||||||
|
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
@ -177,7 +131,7 @@ typedef struct SettingsScreen
|
|||||||
lv_obj_t *display;
|
lv_obj_t *display;
|
||||||
|
|
||||||
/* Other */
|
/* Other */
|
||||||
lv_timer_t *sensors_refresh_timer;
|
lv_timer_t *about_refresh_timer;
|
||||||
SettingsScreenOnStateChangeCb_t settingsScreenOnStateChangeCb;
|
SettingsScreenOnStateChangeCb_t settingsScreenOnStateChangeCb;
|
||||||
SettingsScreenUserFeedbackCb_t settingsScreenUserFeedbackCb;
|
SettingsScreenUserFeedbackCb_t settingsScreenUserFeedbackCb;
|
||||||
} SettingsScreen_t;
|
} SettingsScreen_t;
|
||||||
|
@ -1,13 +1,3 @@
|
|||||||
/**
|
|
||||||
* @file watch_face.c
|
|
||||||
* @author Anatole SCHRAMM-HENRY
|
|
||||||
* @brief Watch face source file implementing API functions.
|
|
||||||
* @version 0.1
|
|
||||||
* @date 2025-04-29
|
|
||||||
*
|
|
||||||
* @copyright MIT
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "lvgl.h"
|
#include "lvgl.h"
|
||||||
#include "watch_face.h"
|
#include "watch_face.h"
|
||||||
#include "menu_screen.h"
|
#include "menu_screen.h"
|
||||||
@ -109,8 +99,6 @@ static void gesture_event_cb(lv_event_t *e)
|
|||||||
// We delete the timer
|
// We delete the timer
|
||||||
lv_timer_del(watchFace->batteryIndicator.lowBatteryAnimationTimer);
|
lv_timer_del(watchFace->batteryIndicator.lowBatteryAnimationTimer);
|
||||||
lv_timer_del(watchFace->handAnimationTimer);
|
lv_timer_del(watchFace->handAnimationTimer);
|
||||||
// Checking if timer is not NULL here because it could have been deleted already
|
|
||||||
if(watchFace->handHideTimer)lv_timer_del(watchFace->handHideTimer);
|
|
||||||
lv_timer_del(watchFace->stepCounterRefreshTimer);
|
lv_timer_del(watchFace->stepCounterRefreshTimer);
|
||||||
// We create the menu screen and switch to it
|
// We create the menu screen and switch to it
|
||||||
extern MenuScreen_t menuScreen;
|
extern MenuScreen_t menuScreen;
|
||||||
@ -239,13 +227,6 @@ static void set_battery_state_icon(WatchFace_t * const watchFace)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
static void hide_hour_and_minutes_hand_timer_cb(lv_timer_t *timer)
|
|
||||||
{
|
|
||||||
WatchFace_t *watchFace = timer->user_data;
|
|
||||||
watchFace->handHideTimer = NULL;
|
|
||||||
|
|
||||||
watch_face_show_hour_and_minute_hands(watchFace, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void hide_hour_and_minutes_hand_cb(lv_event_t *e)
|
static void hide_hour_and_minutes_hand_cb(lv_event_t *e)
|
||||||
{
|
{
|
||||||
@ -253,28 +234,13 @@ static void hide_hour_and_minutes_hand_cb(lv_event_t *e)
|
|||||||
|
|
||||||
if(lv_obj_has_flag(watchFace->hourHand.handImg, LV_OBJ_FLAG_HIDDEN))
|
if(lv_obj_has_flag(watchFace->hourHand.handImg, LV_OBJ_FLAG_HIDDEN))
|
||||||
{
|
{
|
||||||
if(watchFace->handHideTimer)
|
lv_obj_clear_flag(watchFace->hourHand.handImg, LV_OBJ_FLAG_HIDDEN);
|
||||||
{
|
lv_obj_clear_flag(watchFace->minuteHand.handImg, LV_OBJ_FLAG_HIDDEN);
|
||||||
/* Make the timer execute now to re-display hands
|
|
||||||
and cleanly free the timer */
|
|
||||||
lv_timer_ready(watchFace->handHideTimer);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Let's hide the hands
|
lv_obj_add_flag(watchFace->hourHand.handImg, LV_OBJ_FLAG_HIDDEN);
|
||||||
watch_face_show_hour_and_minute_hands(watchFace, false);
|
lv_obj_add_flag(watchFace->minuteHand.handImg, LV_OBJ_FLAG_HIDDEN);
|
||||||
|
|
||||||
// Let's start the hand hide timer
|
|
||||||
if(watchFace->handHideTimer)
|
|
||||||
{
|
|
||||||
LV_LOG_ERROR("handHideTimer should be NULL here !");
|
|
||||||
lv_timer_del(watchFace->handHideTimer);
|
|
||||||
watchFace->handHideTimer = NULL;
|
|
||||||
}
|
|
||||||
watchFace->handHideTimer = lv_timer_create(&(hide_hour_and_minutes_hand_timer_cb), 3000, watchFace);
|
|
||||||
// After the timer expires once, delete it by setting the repeat count to 1
|
|
||||||
lv_timer_set_repeat_count(watchFace->handHideTimer, 1);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -618,7 +584,6 @@ void watch_face_destroy(WatchFace_t * const watchFace)
|
|||||||
|
|
||||||
watchFace->display = NULL;
|
watchFace->display = NULL;
|
||||||
watchFace->handAnimationTimer = NULL;
|
watchFace->handAnimationTimer = NULL;
|
||||||
watchFace->handHideTimer = NULL;
|
|
||||||
watchFace->stepCounterRefreshTimer = NULL;
|
watchFace->stepCounterRefreshTimer = NULL;
|
||||||
watchFace->dateWindow.dateWindowWidget = NULL;
|
watchFace->dateWindow.dateWindowWidget = NULL;
|
||||||
watchFace->hourHand.handImg = NULL;
|
watchFace->hourHand.handImg = NULL;
|
||||||
@ -646,29 +611,6 @@ void watch_face_force_sync(WatchFace_t *const watchFace)
|
|||||||
update_watch_hands_angles(watchFace, 0);
|
update_watch_hands_angles(watchFace, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void watch_face_show_hour_and_minute_hands(WatchFace_t * const watchFace, bool show)
|
|
||||||
{
|
|
||||||
if(!watchFace)
|
|
||||||
{
|
|
||||||
LV_LOG_ERROR("NULL pointer given !");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(watch_face_is_in_use(watchFace))
|
|
||||||
{
|
|
||||||
if(show && lv_obj_has_flag(watchFace->hourHand.handImg, LV_OBJ_FLAG_HIDDEN))
|
|
||||||
{
|
|
||||||
lv_obj_clear_flag(watchFace->hourHand.handImg, LV_OBJ_FLAG_HIDDEN);
|
|
||||||
lv_obj_clear_flag(watchFace->minuteHand.handImg, LV_OBJ_FLAG_HIDDEN);
|
|
||||||
}
|
|
||||||
else if(!show && !lv_obj_has_flag(watchFace->hourHand.handImg, LV_OBJ_FLAG_HIDDEN))
|
|
||||||
{
|
|
||||||
lv_obj_add_flag(watchFace->hourHand.handImg, LV_OBJ_FLAG_HIDDEN);
|
|
||||||
lv_obj_add_flag(watchFace->minuteHand.handImg, LV_OBJ_FLAG_HIDDEN);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool watch_face_is_in_use(WatchFace_t * const watchFace)
|
bool watch_face_is_in_use(WatchFace_t * const watchFace)
|
||||||
{
|
{
|
||||||
if(!watchFace)
|
if(!watchFace)
|
||||||
|
@ -1,13 +1,3 @@
|
|||||||
/**
|
|
||||||
* @file watch_face.h
|
|
||||||
* @author Anatole SCHRAMM-HENRY
|
|
||||||
* @brief Watch face header file exposing related APIs.
|
|
||||||
* @version 0.1
|
|
||||||
* @date 2025-04-29
|
|
||||||
*
|
|
||||||
* @copyright MIT
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef WATCH_FACE_H
|
#ifndef WATCH_FACE_H
|
||||||
#define WATCH_FACE_H
|
#define WATCH_FACE_H
|
||||||
|
|
||||||
@ -79,9 +69,7 @@ typedef struct WatchFace
|
|||||||
WatchHand_t minuteHand;
|
WatchHand_t minuteHand;
|
||||||
WatchHand_t secondHand;
|
WatchHand_t secondHand;
|
||||||
WatchHand_t mediumHand24h;
|
WatchHand_t mediumHand24h;
|
||||||
lv_timer_t *handAnimationTimer;
|
lv_timer_t *handAnimationTimer, *stepCounterRefreshTimer;
|
||||||
lv_timer_t *stepCounterRefreshTimer;
|
|
||||||
lv_timer_t *handHideTimer;
|
|
||||||
lv_obj_t *display;
|
lv_obj_t *display;
|
||||||
DateWindow_t dateWindow;
|
DateWindow_t dateWindow;
|
||||||
BatteryIndicator_t batteryIndicator;
|
BatteryIndicator_t batteryIndicator;
|
||||||
@ -131,6 +119,13 @@ void watch_face_register_step_counter_indicator_cb(WatchFace_t * const watchFace
|
|||||||
*/
|
*/
|
||||||
void watch_face_create(WatchFace_t * const watchFace);
|
void watch_face_create(WatchFace_t * const watchFace);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Sets the battery indicator to the given value in percent.
|
||||||
|
*
|
||||||
|
* @param watchFace a pointer to the watch face context structure.
|
||||||
|
* @param percentage the value to set the indicator to in percent.
|
||||||
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Sets the battery level in percent as well as it's current state to draw on the watch face.
|
* @brief Sets the battery level in percent as well as it's current state to draw on the watch face.
|
||||||
*
|
*
|
||||||
@ -157,26 +152,18 @@ void watch_face_set_bluetooth_indicator(WatchFace_t * const watchFace, Bluetooth
|
|||||||
void watch_face_set_step_count_indicator(WatchFace_t * const watchFace, uint32_t stepCount);
|
void watch_face_set_step_count_indicator(WatchFace_t * const watchFace, uint32_t stepCount);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Forces the watch face to sync up with the RTC by calling the provided date_time_cb.
|
* @brief Forces the watch face to sync up with the RTC by calling the provided date_time_cb
|
||||||
*
|
*
|
||||||
* @param watchFace a pointer to the watch face context structure.
|
* @param watchFace a pointer to the watch face context structure.
|
||||||
*/
|
*/
|
||||||
void watch_face_force_sync(WatchFace_t * const watchFace);
|
void watch_face_force_sync(WatchFace_t * const watchFace);
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Show or hide the hour and minute hand on the watch face.
|
|
||||||
*
|
|
||||||
* @param watchFace a pointer to the watch face context structure.
|
|
||||||
* @param show a boolean value indicating if hands should be shown or not.
|
|
||||||
*/
|
|
||||||
void watch_face_show_hour_and_minute_hands(WatchFace_t * const watchFace, bool show);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Returns true if the watch face screen is currently being used and displayed.
|
* @brief Returns true if the watch face screen is currently being used and displayed.
|
||||||
*
|
*
|
||||||
* @param watchFace a pointer to the watch face context structure.
|
* @param watchFace a pointer to the watch face context structure.
|
||||||
* @return true if the watch face screen is being used.
|
* @return true if the watch face screen is being used
|
||||||
* @return false if the watch face screen is not being used/currently displayed.
|
* @return false if the watch face screen is not being used/currently displayed
|
||||||
*/
|
*/
|
||||||
bool watch_face_is_in_use(WatchFace_t * const watchFace);
|
bool watch_face_is_in_use(WatchFace_t * const watchFace);
|
||||||
|
|
||||||
|
@ -1,13 +1,3 @@
|
|||||||
/**
|
|
||||||
* @file translation.c
|
|
||||||
* @author Anatole SCHRAMM-HENRY
|
|
||||||
* @brief Translation source file storing strings as const for each language.
|
|
||||||
* @version 0.1
|
|
||||||
* @date 2025-04-29
|
|
||||||
*
|
|
||||||
* @copyright MIT
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "wm_type_def.h"
|
#include "wm_type_def.h"
|
||||||
#include "translation.h"
|
#include "translation.h"
|
||||||
#include "watch_settings.h"
|
#include "watch_settings.h"
|
||||||
@ -74,11 +64,6 @@ static const char * const translation_dictionary[][TRANSLATED_LANGUAGES_COUNT] =
|
|||||||
[TRANSLATION_GERMAN] = "Konnektivität",
|
[TRANSLATION_GERMAN] = "Konnektivität",
|
||||||
[TRANSLATION_ENGLISH]= "Connectivity"
|
[TRANSLATION_ENGLISH]= "Connectivity"
|
||||||
},
|
},
|
||||||
[TRANSLATION_SENSORS] = {
|
|
||||||
[TRANSLATION_FRENCH] = "Capteurs",
|
|
||||||
[TRANSLATION_GERMAN] = "Sensoren",
|
|
||||||
[TRANSLATION_ENGLISH]= "Sensors"
|
|
||||||
},
|
|
||||||
[TRANSLATION_LANGUAGE] = {
|
[TRANSLATION_LANGUAGE] = {
|
||||||
[TRANSLATION_FRENCH] = "Langue",
|
[TRANSLATION_FRENCH] = "Langue",
|
||||||
[TRANSLATION_GERMAN] = "Sprache",
|
[TRANSLATION_GERMAN] = "Sprache",
|
||||||
|
@ -1,13 +1,3 @@
|
|||||||
/**
|
|
||||||
* @file translation.h
|
|
||||||
* @author Anatole SCHRAMM-HENRY
|
|
||||||
* @brief Translation header file listing supported languages, translated words and translation API functions.
|
|
||||||
* @version 0.1
|
|
||||||
* @date 2025-04-29
|
|
||||||
*
|
|
||||||
* @copyright MIT
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef TRANSLATION_H
|
#ifndef TRANSLATION_H
|
||||||
#define TRANSLATION_H
|
#define TRANSLATION_H
|
||||||
|
|
||||||
@ -36,7 +26,6 @@ typedef enum TranslationWord
|
|||||||
TRANSLATION_DISPLAY,
|
TRANSLATION_DISPLAY,
|
||||||
TRANSLATION_NOTIFICATIONS,
|
TRANSLATION_NOTIFICATIONS,
|
||||||
TRANSLATION_CONNECTIVITY,
|
TRANSLATION_CONNECTIVITY,
|
||||||
TRANSLATION_SENSORS,
|
|
||||||
TRANSLATION_LANGUAGE,
|
TRANSLATION_LANGUAGE,
|
||||||
TRANSLATION_LANGUAGE_2,
|
TRANSLATION_LANGUAGE_2,
|
||||||
TRANSLATION_ABOUT,
|
TRANSLATION_ABOUT,
|
||||||
|
@ -3,7 +3,7 @@ sinclude $(TOP_DIR)/tools/w800/conf.mk
|
|||||||
|
|
||||||
ifndef PDIR
|
ifndef PDIR
|
||||||
GEN_LIBS = liblvgl$(LIB_EXT)
|
GEN_LIBS = liblvgl$(LIB_EXT)
|
||||||
COMPONENTS_liblvgl = lvgl_v8.4/liblvglv8_4$(LIB_EXT) \
|
COMPONENTS_liblvgl = lvgl_v8.3/liblvglv8_3$(LIB_EXT) \
|
||||||
lvgl_port/liblvgl_port$(LIB_EXT)
|
lvgl_port/liblvgl_port$(LIB_EXT)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/**
|
/**
|
||||||
* @file lv_conf.h
|
* @file lv_conf.h
|
||||||
* Configuration file for v8.4.0
|
* Configuration file for v8.3.3
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -49,7 +49,7 @@
|
|||||||
#define LV_MEM_CUSTOM 0
|
#define LV_MEM_CUSTOM 0
|
||||||
#if LV_MEM_CUSTOM == 0
|
#if LV_MEM_CUSTOM == 0
|
||||||
/*Size of the memory available for `lv_mem_alloc()` in bytes (>= 2kB)*/
|
/*Size of the memory available for `lv_mem_alloc()` in bytes (>= 2kB)*/
|
||||||
#define LV_MEM_SIZE (35U * 1024U) /*[bytes]*/
|
#define LV_MEM_SIZE (35 * 1024U) /*[bytes]*/
|
||||||
|
|
||||||
/*Set an address for the memory pool instead of allocating it as a normal array. Can be in external SRAM too.*/
|
/*Set an address for the memory pool instead of allocating it as a normal array. Can be in external SRAM too.*/
|
||||||
#define LV_MEM_ADR 0 /*0: unused*/
|
#define LV_MEM_ADR 0 /*0: unused*/
|
||||||
@ -89,9 +89,6 @@
|
|||||||
#if LV_TICK_CUSTOM
|
#if LV_TICK_CUSTOM
|
||||||
#define LV_TICK_CUSTOM_INCLUDE "Arduino.h" /*Header for the system time function*/
|
#define LV_TICK_CUSTOM_INCLUDE "Arduino.h" /*Header for the system time function*/
|
||||||
#define LV_TICK_CUSTOM_SYS_TIME_EXPR (millis()) /*Expression evaluating to current system time in ms*/
|
#define LV_TICK_CUSTOM_SYS_TIME_EXPR (millis()) /*Expression evaluating to current system time in ms*/
|
||||||
/*If using lvgl as ESP32 component*/
|
|
||||||
// #define LV_TICK_CUSTOM_INCLUDE "esp_timer.h"
|
|
||||||
// #define LV_TICK_CUSTOM_SYS_TIME_EXPR ((esp_timer_get_time() / 1000LL))
|
|
||||||
#endif /*LV_TICK_CUSTOM*/
|
#endif /*LV_TICK_CUSTOM*/
|
||||||
|
|
||||||
/*Default Dot Per Inch. Used to initialize default sizes such as widgets sized, style paddings.
|
/*Default Dot Per Inch. Used to initialize default sizes such as widgets sized, style paddings.
|
||||||
@ -176,9 +173,6 @@
|
|||||||
* GPU
|
* GPU
|
||||||
*-----------*/
|
*-----------*/
|
||||||
|
|
||||||
/*Use TSi's (aka Think Silicon) acceleration library NemaGFX */
|
|
||||||
#define LV_USE_NEMA_GFX 0
|
|
||||||
|
|
||||||
/*Use Arm's 2D acceleration library Arm-2D */
|
/*Use Arm's 2D acceleration library Arm-2D */
|
||||||
#define LV_USE_GPU_ARM2D 0
|
#define LV_USE_GPU_ARM2D 0
|
||||||
|
|
||||||
@ -186,18 +180,10 @@
|
|||||||
#define LV_USE_GPU_STM32_DMA2D 0
|
#define LV_USE_GPU_STM32_DMA2D 0
|
||||||
#if LV_USE_GPU_STM32_DMA2D
|
#if LV_USE_GPU_STM32_DMA2D
|
||||||
/*Must be defined to include path of CMSIS header of target processor
|
/*Must be defined to include path of CMSIS header of target processor
|
||||||
e.g. "stm32f7xx.h" or "stm32f4xx.h"*/
|
e.g. "stm32f769xx.h" or "stm32f429xx.h"*/
|
||||||
#define LV_GPU_DMA2D_CMSIS_INCLUDE
|
#define LV_GPU_DMA2D_CMSIS_INCLUDE
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*Enable RA6M3 G2D GPU*/
|
|
||||||
#define LV_USE_GPU_RA6M3_G2D 0
|
|
||||||
#if LV_USE_GPU_RA6M3_G2D
|
|
||||||
/*include path of target processor
|
|
||||||
e.g. "hal_data.h"*/
|
|
||||||
#define LV_GPU_RA6M3_G2D_INCLUDE "hal_data.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*Use SWM341's DMA2D GPU*/
|
/*Use SWM341's DMA2D GPU*/
|
||||||
#define LV_USE_GPU_SWM341_DMA2D 0
|
#define LV_USE_GPU_SWM341_DMA2D 0
|
||||||
#if LV_USE_GPU_SWM341_DMA2D
|
#if LV_USE_GPU_SWM341_DMA2D
|
||||||
@ -642,13 +628,6 @@
|
|||||||
#define LV_FS_FATFS_CACHE_SIZE 0 /*>0 to cache this number of bytes in lv_fs_read()*/
|
#define LV_FS_FATFS_CACHE_SIZE 0 /*>0 to cache this number of bytes in lv_fs_read()*/
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*API for LittleFS (library needs to be added separately). Uses lfs_file_open, lfs_file_read, etc*/
|
|
||||||
#define LV_USE_FS_LITTLEFS 0
|
|
||||||
#if LV_USE_FS_LITTLEFS
|
|
||||||
#define LV_FS_LITTLEFS_LETTER '\0' /*Set an upper cased letter on which the drive will accessible (e.g. 'A')*/
|
|
||||||
#define LV_FS_LITTLEFS_CACHE_SIZE 0 /*>0 to cache this number of bytes in lv_fs_read()*/
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*PNG decoder library*/
|
/*PNG decoder library*/
|
||||||
#define LV_USE_PNG 0
|
#define LV_USE_PNG 0
|
||||||
|
|
||||||
@ -682,13 +661,6 @@
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*Tiny TTF library*/
|
|
||||||
#define LV_USE_TINY_TTF 0
|
|
||||||
#if LV_USE_TINY_TTF
|
|
||||||
/*Load TTF data from files*/
|
|
||||||
#define LV_TINY_TTF_FILE_SUPPORT 0
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*Rlottie library*/
|
/*Rlottie library*/
|
||||||
#define LV_USE_RLOTTIE 0
|
#define LV_USE_RLOTTIE 0
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
# Kconfig file for LVGL v8.4
|
# Kconfig file for LVGL v8.0
|
||||||
|
|
||||||
menu "LVGL configuration"
|
menu "LVGL configuration"
|
||||||
|
|
||||||
@ -228,16 +228,6 @@ menu "LVGL configuration"
|
|||||||
Must be defined to include path of CMSIS header of target processor
|
Must be defined to include path of CMSIS header of target processor
|
||||||
e.g. "stm32f769xx.h" or "stm32f429xx.h"
|
e.g. "stm32f769xx.h" or "stm32f429xx.h"
|
||||||
|
|
||||||
config LV_USE_GPU_RA6M3_G2D
|
|
||||||
bool "Enable RA6M3 G2D GPU."
|
|
||||||
config LV_GPU_RA6M3_G2D_INCLUDE
|
|
||||||
string "include path of target processor"
|
|
||||||
depends on LV_USE_GPU_RA6M3_G2D
|
|
||||||
default "hal_data.h"
|
|
||||||
help
|
|
||||||
Must be defined to include path of target processor
|
|
||||||
e.g. "hal_data.h"
|
|
||||||
|
|
||||||
config LV_USE_GPU_SWM341_DMA2D
|
config LV_USE_GPU_SWM341_DMA2D
|
||||||
bool "Enable SWM341 DMA2D GPU."
|
bool "Enable SWM341 DMA2D GPU."
|
||||||
config LV_GPU_SWM341_DMA2D_INCLUDE
|
config LV_GPU_SWM341_DMA2D_INCLUDE
|
||||||
@ -921,8 +911,7 @@ menu "LVGL configuration"
|
|||||||
string "Set the working directory"
|
string "Set the working directory"
|
||||||
depends on LV_USE_FS_STDIO
|
depends on LV_USE_FS_STDIO
|
||||||
config LV_FS_STDIO_CACHE_SIZE
|
config LV_FS_STDIO_CACHE_SIZE
|
||||||
int ">0 to cache this number of bytes in lv_fs_read()"
|
string ">0 to cache this number of bytes in lv_fs_read()"
|
||||||
default 0
|
|
||||||
depends on LV_USE_FS_STDIO
|
depends on LV_USE_FS_STDIO
|
||||||
|
|
||||||
config LV_USE_FS_POSIX
|
config LV_USE_FS_POSIX
|
||||||
@ -964,17 +953,6 @@ menu "LVGL configuration"
|
|||||||
default 0
|
default 0
|
||||||
depends on LV_USE_FS_FATFS
|
depends on LV_USE_FS_FATFS
|
||||||
|
|
||||||
config LV_USE_FS_LITTLEFS
|
|
||||||
bool "File system on top of LittleFS"
|
|
||||||
config LV_FS_LITTLEFS_LETTER
|
|
||||||
int "Set an upper cased letter on which the drive will accessible (e.g. 'A' i.e. 65)"
|
|
||||||
default 0
|
|
||||||
depends on LV_USE_FS_LITTLEFS
|
|
||||||
config LV_FS_LITTLEFS_CACHE_SIZE
|
|
||||||
int ">0 to cache this number of bytes in lv_fs_read()"
|
|
||||||
default 0
|
|
||||||
depends on LV_USE_FS_LITTLEFS
|
|
||||||
|
|
||||||
config LV_USE_PNG
|
config LV_USE_PNG
|
||||||
bool "PNG decoder library"
|
bool "PNG decoder library"
|
||||||
|
|
||||||
@ -1011,13 +989,6 @@ menu "LVGL configuration"
|
|||||||
endmenu
|
endmenu
|
||||||
endif
|
endif
|
||||||
|
|
||||||
config LV_USE_TINY_TTF
|
|
||||||
bool "Tiny TTF library"
|
|
||||||
config LV_TINY_TTF_FILE_SUPPORT
|
|
||||||
bool "Load TTF data from files"
|
|
||||||
depends on LV_USE_TINY_TTF
|
|
||||||
default n
|
|
||||||
|
|
||||||
config LV_USE_RLOTTIE
|
config LV_USE_RLOTTIE
|
||||||
bool "Lottie library"
|
bool "Lottie library"
|
||||||
|
|
@ -2,8 +2,8 @@ TOP_DIR = ../..
|
|||||||
sinclude $(TOP_DIR)/tools/w800/conf.mk
|
sinclude $(TOP_DIR)/tools/w800/conf.mk
|
||||||
|
|
||||||
ifndef PDIR
|
ifndef PDIR
|
||||||
GEN_LIBS = liblvglv8_4$(LIB_EXT)
|
GEN_LIBS = liblvglv8_3$(LIB_EXT)
|
||||||
COMPONENTS_liblvglv8_4 = src/liblvglsrc$(LIB_EXT) \
|
COMPONENTS_liblvglv8_3 = src/liblvglsrc$(LIB_EXT) \
|
||||||
demos/liblvgldemos$(LIB_EXT)
|
demos/liblvgldemos$(LIB_EXT)
|
||||||
endif
|
endif
|
||||||
|
|
@ -16,8 +16,10 @@ LVGL provides everything you need to create an embedded GUI with easy-to-use gra
|
|||||||
<a href="https://docs.lvgl.io/master/examples.html">Interactive examples</a>
|
<a href="https://docs.lvgl.io/master/examples.html">Interactive examples</a>
|
||||||
</h4>
|
</h4>
|
||||||
|
|
||||||
|
|
||||||
**English** | [中文](./README_zh.md) | [Português do Brasil](./README_pt_BR.md)
|
**English** | [中文](./README_zh.md) | [Português do Brasil](./README_pt_BR.md)
|
||||||
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
#### Table of content
|
#### Table of content
|
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 11 KiB |
Before Width: | Height: | Size: 2.4 KiB After Width: | Height: | Size: 2.4 KiB |
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 11 KiB |
@ -89,7 +89,7 @@ LV_FONT_DECLARE(lv_font_benchmark_montserrat_16_compr_az);
|
|||||||
LV_FONT_DECLARE(lv_font_benchmark_montserrat_28_compr_az);
|
LV_FONT_DECLARE(lv_font_benchmark_montserrat_28_compr_az);
|
||||||
|
|
||||||
static void monitor_cb(lv_disp_drv_t * drv, uint32_t time, uint32_t px);
|
static void monitor_cb(lv_disp_drv_t * drv, uint32_t time, uint32_t px);
|
||||||
static void next_scene_timer_cb(lv_timer_t * timer);
|
static void scene_next_task_cb(lv_timer_t * timer);
|
||||||
static void rect_create(lv_style_t * style);
|
static void rect_create(lv_style_t * style);
|
||||||
static void img_create(lv_style_t * style, const void * src, bool rotate, bool zoom, bool aa);
|
static void img_create(lv_style_t * style, const void * src, bool rotate, bool zoom, bool aa);
|
||||||
static void txt_create(lv_style_t * style);
|
static void txt_create(lv_style_t * style);
|
||||||
@ -226,6 +226,7 @@ static void shadow_small_ofs_cb(void)
|
|||||||
rect_create(&style_common);
|
rect_create(&style_common);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void shadow_large_cb(void)
|
static void shadow_large_cb(void)
|
||||||
{
|
{
|
||||||
lv_style_reset(&style_common);
|
lv_style_reset(&style_common);
|
||||||
@ -249,6 +250,7 @@ static void shadow_large_ofs_cb(void)
|
|||||||
rect_create(&style_common);
|
rect_create(&style_common);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void img_rgb_cb(void)
|
static void img_rgb_cb(void)
|
||||||
{
|
{
|
||||||
lv_style_reset(&style_common);
|
lv_style_reset(&style_common);
|
||||||
@ -291,6 +293,7 @@ static void img_alpha_cb(void)
|
|||||||
img_create(&style_common, &img_benchmark_cogwheel_alpha16, false, false, false);
|
img_create(&style_common, &img_benchmark_cogwheel_alpha16, false, false, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void img_rgb_recolor_cb(void)
|
static void img_rgb_recolor_cb(void)
|
||||||
{
|
{
|
||||||
lv_style_reset(&style_common);
|
lv_style_reset(&style_common);
|
||||||
@ -379,6 +382,7 @@ static void img_rgb_zoom_aa_cb(void)
|
|||||||
lv_style_set_img_opa(&style_common, opa_mode ? LV_OPA_50 : LV_OPA_COVER);
|
lv_style_set_img_opa(&style_common, opa_mode ? LV_OPA_50 : LV_OPA_COVER);
|
||||||
img_create(&style_common, &img_benchmark_cogwheel_rgb, false, true, true);
|
img_create(&style_common, &img_benchmark_cogwheel_rgb, false, true, true);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void img_argb_zoom_cb(void)
|
static void img_argb_zoom_cb(void)
|
||||||
@ -392,6 +396,7 @@ static void img_argb_zoom_cb(void)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void img_argb_zoom_aa_cb(void)
|
static void img_argb_zoom_aa_cb(void)
|
||||||
{
|
{
|
||||||
lv_style_reset(&style_common);
|
lv_style_reset(&style_common);
|
||||||
@ -457,6 +462,7 @@ static void txt_large_compr_cb(void)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void line_cb(void)
|
static void line_cb(void)
|
||||||
{
|
{
|
||||||
lv_style_reset(&style_common);
|
lv_style_reset(&style_common);
|
||||||
@ -484,6 +490,7 @@ static void arc_thick_cb(void)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void sub_rectangle_cb(void)
|
static void sub_rectangle_cb(void)
|
||||||
{
|
{
|
||||||
lv_style_reset(&style_common);
|
lv_style_reset(&style_common);
|
||||||
@ -556,6 +563,8 @@ static void sub_text_cb(void)
|
|||||||
txt_create(&style_common);
|
txt_create(&style_common);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**********************
|
/**********************
|
||||||
* STATIC VARIABLES
|
* STATIC VARIABLES
|
||||||
**********************/
|
**********************/
|
||||||
@ -627,7 +636,7 @@ static lv_obj_t * scene_bg;
|
|||||||
static lv_obj_t * title;
|
static lv_obj_t * title;
|
||||||
static lv_obj_t * subtitle;
|
static lv_obj_t * subtitle;
|
||||||
static uint32_t rnd_act;
|
static uint32_t rnd_act;
|
||||||
static lv_timer_t * next_scene_timer;
|
|
||||||
|
|
||||||
static const uint32_t rnd_map[] = {
|
static const uint32_t rnd_map[] = {
|
||||||
0xbd13204f, 0x67d8167f, 0x20211c99, 0xb0a7cc05,
|
0xbd13204f, 0x67d8167f, 0x20211c99, 0xb0a7cc05,
|
||||||
@ -693,26 +702,15 @@ static void benchmark_init(void)
|
|||||||
lv_obj_update_layout(scr);
|
lv_obj_update_layout(scr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void lv_demo_benchmark(void)
|
void lv_demo_benchmark(void)
|
||||||
{
|
{
|
||||||
benchmark_init();
|
benchmark_init();
|
||||||
|
|
||||||
/*Manually start scenes*/
|
/*Manually start scenes*/
|
||||||
next_scene_timer_cb(NULL);
|
scene_next_task_cb(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
void lv_demo_benchmark_close(void)
|
|
||||||
{
|
|
||||||
if(next_scene_timer) lv_timer_del(next_scene_timer);
|
|
||||||
next_scene_timer = NULL;
|
|
||||||
|
|
||||||
lv_anim_del(NULL, NULL);
|
|
||||||
|
|
||||||
lv_style_reset(&style_common);
|
|
||||||
|
|
||||||
lv_obj_clean(lv_scr_act());
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void lv_demo_benchmark_run_scene(int_fast16_t scene_no)
|
void lv_demo_benchmark_run_scene(int_fast16_t scene_no)
|
||||||
{
|
{
|
||||||
@ -727,8 +725,8 @@ void lv_demo_benchmark_run_scene(int_fast16_t scene_no)
|
|||||||
scene_act = scene_no >> 1;
|
scene_act = scene_no >> 1;
|
||||||
|
|
||||||
if(scenes[scene_act].create_cb) {
|
if(scenes[scene_act].create_cb) {
|
||||||
lv_label_set_text_fmt(title, "%"LV_PRId32"/%"LV_PRId32": %s%s", scene_act * 2 + (opa_mode ? 1 : 0),
|
lv_label_set_text_fmt(title, "%"LV_PRId32"/"LV_PRId32": %s%s", scene_act * 2 + (opa_mode ? 1 : 0),
|
||||||
(int32_t)(dimof(scenes) * 2) - 2,
|
(int)(dimof(scenes) * 2) - 2,
|
||||||
scenes[scene_act].name, opa_mode ? " + opa" : "");
|
scenes[scene_act].name, opa_mode ? " + opa" : "");
|
||||||
lv_label_set_text(subtitle, "");
|
lv_label_set_text(subtitle, "");
|
||||||
|
|
||||||
@ -740,6 +738,7 @@ void lv_demo_benchmark_run_scene(int_fast16_t scene_no)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void lv_demo_benchmark_set_finished_cb(finished_cb_t * finished_cb)
|
void lv_demo_benchmark_set_finished_cb(finished_cb_t * finished_cb)
|
||||||
{
|
{
|
||||||
benchmark_finished_cb = finished_cb;
|
benchmark_finished_cb = finished_cb;
|
||||||
@ -788,6 +787,7 @@ static void generate_report(void)
|
|||||||
weight_opa_sum += w;
|
weight_opa_sum += w;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
fps_sum = fps_normal_sum + fps_opa_sum;
|
fps_sum = fps_normal_sum + fps_opa_sum;
|
||||||
weight_sum = weight_normal_sum + weight_opa_sum;
|
weight_sum = weight_normal_sum + weight_opa_sum;
|
||||||
|
|
||||||
@ -804,6 +804,7 @@ static void generate_report(void)
|
|||||||
lv_obj_clean(lv_scr_act());
|
lv_obj_clean(lv_scr_act());
|
||||||
scene_bg = NULL;
|
scene_bg = NULL;
|
||||||
|
|
||||||
|
|
||||||
lv_obj_set_flex_flow(lv_scr_act(), LV_FLEX_FLOW_COLUMN);
|
lv_obj_set_flex_flow(lv_scr_act(), LV_FLEX_FLOW_COLUMN);
|
||||||
|
|
||||||
title = lv_label_create(lv_scr_act());
|
title = lv_label_create(lv_scr_act());
|
||||||
@ -839,6 +840,7 @@ static void generate_report(void)
|
|||||||
// lv_obj_add_style(table, LV_TABLE_PART_CELL3, &style_cell_very_slow);
|
// lv_obj_add_style(table, LV_TABLE_PART_CELL3, &style_cell_very_slow);
|
||||||
// lv_obj_add_style(table, LV_TABLE_PART_CELL4, &style_cell_title);
|
// lv_obj_add_style(table, LV_TABLE_PART_CELL4, &style_cell_title);
|
||||||
|
|
||||||
|
|
||||||
uint16_t row = 0;
|
uint16_t row = 0;
|
||||||
lv_table_add_cell_ctrl(table, row, 0, LV_TABLE_CELL_CTRL_MERGE_RIGHT);
|
lv_table_add_cell_ctrl(table, row, 0, LV_TABLE_CELL_CTRL_MERGE_RIGHT);
|
||||||
lv_table_set_cell_value(table, row, 0, "Slow but common cases");
|
lv_table_set_cell_value(table, row, 0, "Slow but common cases");
|
||||||
@ -925,6 +927,7 @@ static void generate_report(void)
|
|||||||
lv_snprintf(buf, sizeof(buf), "%"LV_PRIu32, scenes[i].fps_opa);
|
lv_snprintf(buf, sizeof(buf), "%"LV_PRIu32, scenes[i].fps_opa);
|
||||||
lv_table_set_cell_value(table, row, 1, buf);
|
lv_table_set_cell_value(table, row, 1, buf);
|
||||||
|
|
||||||
|
|
||||||
if(scenes[i].fps_opa < 10) {
|
if(scenes[i].fps_opa < 10) {
|
||||||
// lv_table_set_cell_type(table, row, 0, 3);
|
// lv_table_set_cell_type(table, row, 0, 3);
|
||||||
// lv_table_set_cell_type(table, row, 1, 3);
|
// lv_table_set_cell_type(table, row, 1, 3);
|
||||||
@ -970,13 +973,11 @@ static void report_cb(lv_timer_t * timer)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void next_scene_timer_cb(lv_timer_t * timer)
|
static void scene_next_task_cb(lv_timer_t * timer)
|
||||||
{
|
{
|
||||||
LV_UNUSED(timer);
|
LV_UNUSED(timer);
|
||||||
lv_obj_clean(scene_bg);
|
lv_obj_clean(scene_bg);
|
||||||
|
|
||||||
next_scene_timer = NULL;
|
|
||||||
|
|
||||||
if(opa_mode) {
|
if(opa_mode) {
|
||||||
if(scene_act >= 0) {
|
if(scene_act >= 0) {
|
||||||
if(scenes[scene_act].time_sum_opa == 0) scenes[scene_act].time_sum_opa = 1;
|
if(scenes[scene_act].time_sum_opa == 0) scenes[scene_act].time_sum_opa = 1;
|
||||||
@ -995,8 +996,8 @@ static void next_scene_timer_cb(lv_timer_t * timer)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(scenes[scene_act].create_cb) {
|
if(scenes[scene_act].create_cb) {
|
||||||
lv_label_set_text_fmt(title, "%"LV_PRId32"/%"LV_PRId32": %s%s", scene_act * 2 + (opa_mode ? 1 : 0),
|
lv_label_set_text_fmt(title, "%"LV_PRId32"/"LV_PRId32": %s%s", scene_act * 2 + (opa_mode ? 1 : 0),
|
||||||
(int32_t)(dimof(scenes) * 2) - 2, scenes[scene_act].name, opa_mode ? " + opa" : "");
|
(int)(dimof(scenes) * 2) - 2, scenes[scene_act].name, opa_mode ? " + opa" : "");
|
||||||
if(opa_mode) {
|
if(opa_mode) {
|
||||||
lv_label_set_text_fmt(subtitle, "Result of \"%s\": %"LV_PRId32" FPS", scenes[scene_act].name,
|
lv_label_set_text_fmt(subtitle, "Result of \"%s\": %"LV_PRId32" FPS", scenes[scene_act].name,
|
||||||
scenes[scene_act].fps_normal);
|
scenes[scene_act].fps_normal);
|
||||||
@ -1013,8 +1014,8 @@ static void next_scene_timer_cb(lv_timer_t * timer)
|
|||||||
|
|
||||||
rnd_reset();
|
rnd_reset();
|
||||||
scenes[scene_act].create_cb();
|
scenes[scene_act].create_cb();
|
||||||
next_scene_timer = lv_timer_create(next_scene_timer_cb, SCENE_TIME, NULL);
|
lv_timer_t * t = lv_timer_create(scene_next_task_cb, SCENE_TIME, NULL);
|
||||||
lv_timer_set_repeat_count(next_scene_timer, 1);
|
lv_timer_set_repeat_count(t, 1);
|
||||||
|
|
||||||
}
|
}
|
||||||
/*Ready*/
|
/*Ready*/
|
||||||
@ -1036,6 +1037,7 @@ static void next_scene_timer_cb(lv_timer_t * timer)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void rect_create(lv_style_t * style)
|
static void rect_create(lv_style_t * style)
|
||||||
{
|
{
|
||||||
uint32_t i;
|
uint32_t i;
|
||||||
@ -1053,6 +1055,7 @@ static void rect_create(lv_style_t * style)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void img_create(lv_style_t * style, const void * src, bool rotate, bool zoom, bool aa)
|
static void img_create(lv_style_t * style, const void * src, bool rotate, bool zoom, bool aa)
|
||||||
{
|
{
|
||||||
uint32_t i;
|
uint32_t i;
|
||||||
@ -1071,6 +1074,7 @@ static void img_create(lv_style_t * style, const void * src, bool rotate, bool z
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void txt_create(lv_style_t * style)
|
static void txt_create(lv_style_t * style)
|
||||||
{
|
{
|
||||||
uint32_t i;
|
uint32_t i;
|
||||||
@ -1086,6 +1090,7 @@ static void txt_create(lv_style_t * style)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void line_create(lv_style_t * style)
|
static void line_create(lv_style_t * style)
|
||||||
{
|
{
|
||||||
static lv_point_t points[OBJ_NUM][LINE_POINT_NUM];
|
static lv_point_t points[OBJ_NUM][LINE_POINT_NUM];
|
||||||
@ -1100,6 +1105,7 @@ static void line_create(lv_style_t * style)
|
|||||||
points[i][j].y = rnd_next(LINE_POINT_DIFF_MIN, LINE_POINT_DIFF_MAX);
|
points[i][j].y = rnd_next(LINE_POINT_DIFF_MIN, LINE_POINT_DIFF_MAX);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
lv_obj_t * obj = lv_line_create(scene_bg);
|
lv_obj_t * obj = lv_line_create(scene_bg);
|
||||||
lv_obj_remove_style_all(obj);
|
lv_obj_remove_style_all(obj);
|
||||||
lv_obj_add_style(obj, style, 0);
|
lv_obj_add_style(obj, style, 0);
|
||||||
@ -1112,6 +1118,7 @@ static void line_create(lv_style_t * style)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void arc_anim_end_angle_cb(void * var, int32_t v)
|
static void arc_anim_end_angle_cb(void * var, int32_t v)
|
||||||
{
|
{
|
||||||
lv_arc_set_end_angle(var, v);
|
lv_arc_set_end_angle(var, v);
|
||||||
@ -1145,6 +1152,7 @@ static void arc_create(lv_style_t * style)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void fall_anim_y_cb(void * var, int32_t v)
|
static void fall_anim_y_cb(void * var, int32_t v)
|
||||||
{
|
{
|
||||||
lv_obj_set_y(var, v);
|
lv_obj_set_y(var, v);
|
@ -24,13 +24,12 @@ extern "C" {
|
|||||||
**********************/
|
**********************/
|
||||||
typedef void finished_cb_t(void);
|
typedef void finished_cb_t(void);
|
||||||
|
|
||||||
|
|
||||||
/**********************
|
/**********************
|
||||||
* GLOBAL PROTOTYPES
|
* GLOBAL PROTOTYPES
|
||||||
**********************/
|
**********************/
|
||||||
void lv_demo_benchmark(void);
|
void lv_demo_benchmark(void);
|
||||||
|
|
||||||
void lv_demo_benchmark_close(void);
|
|
||||||
|
|
||||||
void lv_demo_benchmark_run_scene(int_fast16_t scene_no);
|
void lv_demo_benchmark_run_scene(int_fast16_t scene_no);
|
||||||
|
|
||||||
void lv_demo_benchmark_set_finished_cb(finished_cb_t * finished_cb);
|
void lv_demo_benchmark_set_finished_cb(finished_cb_t * finished_cb);
|
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 15 KiB |
@ -46,11 +46,8 @@ static lv_obj_t * t2;
|
|||||||
|
|
||||||
void lv_demo_keypad_encoder(void)
|
void lv_demo_keypad_encoder(void)
|
||||||
{
|
{
|
||||||
g = lv_group_get_default();
|
|
||||||
if(g == NULL) {
|
|
||||||
g = lv_group_create();
|
g = lv_group_create();
|
||||||
lv_group_set_default(g);
|
lv_group_set_default(g);
|
||||||
}
|
|
||||||
|
|
||||||
lv_indev_t * cur_drv = NULL;
|
lv_indev_t * cur_drv = NULL;
|
||||||
for(;;) {
|
for(;;) {
|
||||||
@ -79,12 +76,6 @@ void lv_demo_keypad_encoder(void)
|
|||||||
msgbox_create();
|
msgbox_create();
|
||||||
}
|
}
|
||||||
|
|
||||||
void lv_demo_keypad_encoder_close(void)
|
|
||||||
{
|
|
||||||
lv_obj_clean(lv_scr_act());
|
|
||||||
lv_obj_clean(lv_layer_top());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**********************
|
/**********************
|
||||||
* STATIC FUNCTIONS
|
* STATIC FUNCTIONS
|
||||||
**********************/
|
**********************/
|
@ -27,7 +27,6 @@ extern "C" {
|
|||||||
* GLOBAL PROTOTYPES
|
* GLOBAL PROTOTYPES
|
||||||
**********************/
|
**********************/
|
||||||
void lv_demo_keypad_encoder(void);
|
void lv_demo_keypad_encoder(void);
|
||||||
void lv_demo_keypad_encoder_close(void);
|
|
||||||
|
|
||||||
/**********************
|
/**********************
|
||||||
* MACROS
|
* MACROS
|
Before Width: | Height: | Size: 127 KiB After Width: | Height: | Size: 127 KiB |
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
@ -47,6 +47,7 @@ extern "C" {
|
|||||||
* GLOBAL PROTOTYPES
|
* GLOBAL PROTOTYPES
|
||||||
**********************/
|
**********************/
|
||||||
|
|
||||||
|
|
||||||
/**********************
|
/**********************
|
||||||
* MACROS
|
* MACROS
|
||||||
**********************/
|
**********************/
|