Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/batmon/batmon.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ int main(int argc, char *argv[])
// Charging just started
lowest_percentage_after_charge = 500; // Reset lowest percentage before charge
is_charging = true;
if (DEVICE_ID == MIYOO354) {
if (HAS_AXP()) {
current_percentage = getBatPercMMP();
// To solve : Sometimes getBatPercMMP returns 1735289191
current_percentage = (current_percentage > 100) ? old_percentage : current_percentage;
Expand Down Expand Up @@ -72,7 +72,7 @@ int main(int argc, char *argv[])
current_percentage = batteryPercentage(adc_value_g);
saveFakeAxpResult(current_percentage);
}
else if (DEVICE_ID == MIYOO354) {
else if (HAS_AXP()) {
current_percentage = getBatPercMMP();
}
update_current_duration();
Expand All @@ -95,7 +95,7 @@ int main(int argc, char *argv[])
current_percentage = lowest_percentage_after_charge;
}
}
else if (DEVICE_ID == MIYOO354) {
else if (HAS_AXP()) {
current_percentage = getBatPercMMP();
// To solve : Sometimes getBatPercMMP returns 1735289191
current_percentage = (current_percentage > 100) ? old_percentage : current_percentage;
Expand Down
2 changes: 1 addition & 1 deletion src/chargingState/chargingState.c
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ int main(void)

if (!suspended) {
if (ticks - display_timer >= DISPLAY_TIMEOUT) {
if (DEVICE_ID == MIYOO354) {
if (HAS_AXP()) {
quit = true;
turn_off = true;
break;
Expand Down
2 changes: 1 addition & 1 deletion src/common/system/battery.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ bool battery_isCharging(void)

return charging == '1';
}
else if (DEVICE_ID == MIYOO354) {
else if (IS_MIYOO_PLUS_OR_FLIP()) {
char *cmd = "cd /customer/app/ ; ./axp_test";
int batJsonSize = 100;
char buf[batJsonSize];
Expand Down
6 changes: 6 additions & 0 deletions src/common/system/device_model.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,20 @@
#include <stdio.h>

#define MIYOO283 283
#define MIYOO285 285
#define MIYOO354 354

#define IS_MIYOO_PLUS_OR_FLIP() (DEVICE_ID == MIYOO285 || DEVICE_ID == MIYOO354)
#define HAS_AXP() IS_MIYOO_PLUS_OR_FLIP()
#define HAS_WIFI() IS_MIYOO_PLUS_OR_FLIP()

static int DEVICE_ID;
static char DEVICE_SN[13];

/**
* @brief Get device model
* MM = Miyoo mini
* MMF = Miyoo mini flip
* MMP = Miyoo mini plus
*/

Expand Down
1 change: 1 addition & 0 deletions src/common/system/keymap_hw.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,6 @@
#define HW_BTN_POWER KEY_POWER
#define HW_BTN_VOLUME_UP KEY_VOLUMEUP
#define HW_BTN_VOLUME_DOWN KEY_VOLUMEDOWN
#define HW_BTN_LID_CLOSE KEY_SLEEP

#endif // KEYMAP_HW_H__
4 changes: 4 additions & 0 deletions src/common/system/settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ typedef struct settings_s {
char blue_light_time[16];
char blue_light_time_off[16];
bool rtc_available;
int lid_close_action;

char mainui_button_x[JSON_STRING_LEN];
char mainui_button_y[JSON_STRING_LEN];
Expand Down Expand Up @@ -121,6 +122,7 @@ static settings_s __default_settings = (settings_s){
.blue_light_time = "20:00",
.blue_light_time_off = "08:00",
.pwmfrequency = 7,
.lid_close_action = 0,
.mainui_button_x = "",
.mainui_button_y = "",
//utility
Expand Down Expand Up @@ -232,6 +234,7 @@ void settings_load(void)
config_get("display/blueLightRGB", CONFIG_INT, &settings.blue_light_rgb);
config_get("pwmfrequency", CONFIG_INT, &settings.pwmfrequency);
config_get("recCountdown", CONFIG_INT, &settings.rec_countdown);
config_get("flip/lidCloseAction", CONFIG_INT, &settings.lid_close_action);

if (config_flag_get(".menuInverted")) { // flag is deprecated, but keep compatibility
settings.ingame_single_press = 2;
Expand Down Expand Up @@ -362,6 +365,7 @@ void settings_save(void)
config_setNumber("display/blueLightRGB", settings.blue_light_rgb);
config_setString("display/blueLightTime", settings.blue_light_time);
config_setString("display/blueLightTimeOff", settings.blue_light_time_off);
config_setNumber("flip/lidCloseAction", settings.lid_close_action);

config_setNumber("pwmfrequency", settings.pwmfrequency);
// remove deprecated flags
Expand Down
2 changes: 1 addition & 1 deletion src/cpuclock/cpuclock.c
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ void set_cpuclock(int clock)
int main(int argc, char *argv[])
{
getDeviceModel();
if (DEVICE_ID != MIYOO354 && DEVICE_ID != MIYOO283) {
if (!DEVICE_ID) {
puts("This tool is only for Miyoo Mini");
return 1;
}
Expand Down
Loading