Skip to content

Commit

Permalink
added hw v2.5
Browse files Browse the repository at this point in the history
  • Loading branch information
nplan committed Apr 20, 2024
1 parent fe877b6 commit e1f9d7d
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Firmware/HomeButtonsArduino/src/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

// ------ device ------
static constexpr char MANUFACTURER[] = "PLab";
static constexpr char SW_VERSION[] = "v2.4.2";
static constexpr char SW_VERSION[] = "v2.4.3";
#ifndef HOME_BUTTONS_MINI
static constexpr char SW_MODEL_ID[] = "A1";
#else
Expand Down
2 changes: 1 addition & 1 deletion Firmware/HomeButtonsArduino/src/factory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ bool FactoryTest::run_test(HardwareDefinition& HW, Display& display) {
test_spec_.temp_ref, test_spec_.temp_tol);
}
if (hmd_val <= test_spec_.humd_ref - test_spec_.humd_tol ||
temp_val >= test_spec_.humd_ref + test_spec_.humd_tol) {
hmd_val >= test_spec_.humd_ref + test_spec_.humd_tol) {
sensor_passed = false;
error("humidity test fail. Measured: %f, expected: %f +/- %f", hmd_val,
test_spec_.humd_ref, test_spec_.humd_tol);
Expand Down
62 changes: 62 additions & 0 deletions Firmware/HomeButtonsArduino/src/hardware.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,9 @@ bool HardwareDefinition::init() {
} else if (strcmp(hw_ver, "2.4") == 0) {
load_hw_rev_2_4();
info("configured for hw version: 2.4");
} else if (strcmp(hw_ver, "2.5") == 0) {
load_hw_rev_2_5();
info("configured for hw version: 2.5");
} else {
error("HW rev %s not supported", hw_ver);
return false;
Expand Down Expand Up @@ -752,6 +755,65 @@ void HardwareDefinition::load_hw_rev_2_4() { // ------ PIN definitions ------
WAKE_BITMASK = 0x204072;
}

void HardwareDefinition::load_hw_rev_2_5() { // ------ PIN definitions ------
version = semver::version{2, 5, 0};
BTN1_PIN = 5;
BTN2_PIN = 6;
BTN3_PIN = 21;
BTN4_PIN = 1;
BTN5_PIN = 14;
BTN6_PIN = 4;

LED1_PIN = 15;
LED2_PIN = 16;
LED3_PIN = 17;
LED4_PIN = 2;
LED5_PIN = 38;
LED6_PIN = 37;

SDA = 10;
SCL = 11;
VBAT_ADC = 3;
CHARGER_STDBY = 12;
BOOST_EN = 13;
DC_IN_DETECT = 33;
CHG_ENABLE = 45;

EINK_CS = 34;
EINK_DC = 8;
EINK_RST = 9;
EINK_BUSY = 7;

// ------ LED analog parameters ------
LED1_CH = 0;
LED2_CH = 1;
LED3_CH = 2;
LED4_CH = 3;
LED5_CH = 4;
LED6_CH = 5;

LED_RES = 8;
LED_FREQ = 1000;
LED_BRIGHT_DFLT = 25;

// ------ battery reading ------“
BATT_DIVIDER = 0.5;
BATT_ADC_REF_VOLT = 2.6;
MIN_BATT_VOLT = 3.3;
BATT_HYSTERESIS_VOLT = 3.4;
WARN_BATT_VOLT = 3.5;
BATT_FULL_VOLT = 4.2;
BATT_EMPTY_VOLT = 3.3;
BATT_PRESENT_VOLT = 2.7;
DC_DETECT_VOLT = 4.5;
CHARGE_HYSTERESIS_VOLT = 4.0;
BATT_SOC_EST_K = 126.58;
BATT_SOC_EST_N = -425.32;

// ------ wakeup ------
WAKE_BITMASK = 0x204072;
}

void HardwareDefinition::load_mini_hw_rev_0_1() {
version = semver::version{0, 1, 0};
BTN1_PIN = 21;
Expand Down
1 change: 1 addition & 0 deletions Firmware/HomeButtonsArduino/src/hardware.h
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ struct HardwareDefinition : public Logger {
void load_hw_rev_2_2();
void load_hw_rev_2_3();
void load_hw_rev_2_4();
void load_hw_rev_2_5();

void load_mini_hw_rev_0_1();
void load_mini_hw_rev_1_1();
Expand Down

0 comments on commit e1f9d7d

Please sign in to comment.