diff --git a/PCB/libraries/Xbee3.kicad_sym b/PCB/libraries/Xbee3.kicad_sym index b266c15..7e17322 100644 --- a/PCB/libraries/Xbee3.kicad_sym +++ b/PCB/libraries/Xbee3.kicad_sym @@ -121,4 +121,150 @@ ) ) ) + (symbol "XB3-24Z8UM-J" (pin_names (offset 1.016)) (in_bom yes) (on_board yes) + (property "Reference" "IC" (at -33.02 26.035 0) + (effects (font (size 1.27 1.27)) (justify bottom left)) + ) + (property "Value" "XB3-24Z8UM-J" (at -33.02 -25.4 0) + (effects (font (size 1.27 1.27)) (justify bottom left)) + ) + (property "Footprint" "Xbee3:XB324Z8UMJ" (at 0 0 0) + (effects (font (size 1.27 1.27)) (justify bottom) hide) + ) + (property "Datasheet" "https://docs.digi.com/resources/documentation/digidocs/pdfs/90001543.pdf" (at 0 0 0) + (effects (font (size 1.27 1.27)) (justify bottom) hide) + ) + (property "ki_description" "802.15.4 Zigbee Transceiver Module 2.4GHz, Antenna Not Included, U.FL, Micro SMT (castellated)" (at 0 0 0) + (effects (font (size 1.27 1.27)) (justify bottom) hide) + ) + (property "Manufacturer_Name" "Digi International" (at 0 0 0) + (effects (font (size 1.27 1.27)) (justify bottom) hide) + ) + (property "Manufacturer_Part_Number" "XB3-24Z8UM-J" (at 0 0 0) + (effects (font (size 1.27 1.27)) (justify bottom) hide) + ) + (symbol "XB3-24Z8UM-J_0_0" + (rectangle (start -33.02 -22.86) (end 33.02 25.4) + (stroke (width 0.254)) (fill (type background)) + ) + ) + (symbol "XB3-24Z8UM-J_0_1" + (pin power_in line (at 38.1 -20.32 180.0) (length 5.08) + (name "GND" (effects (font (size 1.016 1.016)))) + (number "1" (effects (font (size 1.016 1.016)))) + ) + (pin power_in line (at 38.1 -20.32 180.0) (length 5.08) hide + (name "GND" (effects (font (size 1.016 1.016)))) + (number "10" (effects (font (size 1.016 1.016)))) + ) + (pin power_in line (at 38.1 -20.32 180.0) (length 5.08) hide + (name "GND" (effects (font (size 1.016 1.016)))) + (number "12" (effects (font (size 1.016 1.016)))) + ) + (pin power_in line (at 38.1 -20.32 180.0) (length 5.08) hide + (name "GND" (effects (font (size 1.016 1.016)))) + (number "21" (effects (font (size 1.016 1.016)))) + ) + (pin power_in line (at 38.1 -20.32 180.0) (length 5.08) hide + (name "GND" (effects (font (size 1.016 1.016)))) + (number "32" (effects (font (size 1.016 1.016)))) + ) + (pin power_in line (at 38.1 -20.32 180.0) (length 5.08) hide + (name "GND" (effects (font (size 1.016 1.016)))) + (number "34" (effects (font (size 1.016 1.016)))) + ) + (pin power_in line (at 38.1 22.86 180.0) (length 5.08) + (name "VCC" (effects (font (size 1.016 1.016)))) + (number "2" (effects (font (size 1.016 1.016)))) + ) + (pin bidirectional line (at 38.1 5.08 180.0) (length 5.08) + (name "DOUT/DIO13" (effects (font (size 1.016 1.016)))) + (number "3" (effects (font (size 1.016 1.016)))) + ) + (pin bidirectional line (at 38.1 2.54 180.0) (length 5.08) + (name "DIN/~{CONFIG}/DIO14" (effects (font (size 1.016 1.016)))) + (number "4" (effects (font (size 1.016 1.016)))) + ) + (pin bidirectional line (at 38.1 7.62 180.0) (length 5.08) + (name "DIO12" (effects (font (size 1.016 1.016)))) + (number "5" (effects (font (size 1.016 1.016)))) + ) + (pin input line (at -38.1 17.78 0) (length 5.08) + (name "~{RESET}" (effects (font (size 1.016 1.016)))) + (number "6" (effects (font (size 1.016 1.016)))) + ) + (pin bidirectional line (at 38.1 12.7 180.0) (length 5.08) + (name "RSSI_PWM/DIO10" (effects (font (size 1.016 1.016)))) + (number "7" (effects (font (size 1.016 1.016)))) + ) + (pin bidirectional line (at 38.1 10.16 180.0) (length 5.08) + (name "PWM1/DIO11" (effects (font (size 1.016 1.016)))) + (number "8" (effects (font (size 1.016 1.016)))) + ) + (pin bidirectional line (at -38.1 -7.62 0) (length 5.08) + (name "~{DTR}/SLEEP_RQ/DIO8" (effects (font (size 1.016 1.016)))) + (number "9" (effects (font (size 1.016 1.016)))) + ) + (pin bidirectional line (at 38.1 -10.16 180.0) (length 5.08) + (name "SPI_~{ATTN}/~{BOOTMODE}/DIO19" (effects (font (size 1.016 1.016)))) + (number "11" (effects (font (size 1.016 1.016)))) + ) + (pin bidirectional line (at 38.1 -7.62 180.0) (length 5.08) + (name "SPI_CLK/DIO18" (effects (font (size 1.016 1.016)))) + (number "13" (effects (font (size 1.016 1.016)))) + ) + (pin bidirectional line (at 38.1 -5.08 180.0) (length 5.08) + (name "SPI_~{SSEL}/DIO17" (effects (font (size 1.016 1.016)))) + (number "14" (effects (font (size 1.016 1.016)))) + ) + (pin bidirectional line (at 38.1 -2.54 180.0) (length 5.08) + (name "SPI_MOSI/DIO16" (effects (font (size 1.016 1.016)))) + (number "15" (effects (font (size 1.016 1.016)))) + ) + (pin bidirectional line (at 38.1 0.0 180.0) (length 5.08) + (name "SPI_MISO/DIO15" (effects (font (size 1.016 1.016)))) + (number "16" (effects (font (size 1.016 1.016)))) + ) + (pin bidirectional line (at -38.1 2.54 0) (length 5.08) + (name "DIO4" (effects (font (size 1.016 1.016)))) + (number "23" (effects (font (size 1.016 1.016)))) + ) + (pin bidirectional line (at -38.1 -5.08 0) (length 5.08) + (name "~{CTS}/DIO7" (effects (font (size 1.016 1.016)))) + (number "24" (effects (font (size 1.016 1.016)))) + ) + (pin bidirectional line (at -38.1 -10.16 0) (length 5.08) + (name "ON/~{SLEEP}/DIO9" (effects (font (size 1.016 1.016)))) + (number "25" (effects (font (size 1.016 1.016)))) + ) + (pin bidirectional line (at -38.1 0.0 0) (length 5.08) + (name "ASSOCIATE/DIO5" (effects (font (size 1.016 1.016)))) + (number "26" (effects (font (size 1.016 1.016)))) + ) + (pin bidirectional line (at -38.1 -2.54 0) (length 5.08) + (name "~{RTS}/DIO6" (effects (font (size 1.016 1.016)))) + (number "27" (effects (font (size 1.016 1.016)))) + ) + (pin bidirectional line (at -38.1 5.08 0) (length 5.08) + (name "AD3/DIO3" (effects (font (size 1.016 1.016)))) + (number "28" (effects (font (size 1.016 1.016)))) + ) + (pin bidirectional line (at -38.1 7.62 0) (length 5.08) + (name "AD2/DIO2" (effects (font (size 1.016 1.016)))) + (number "29" (effects (font (size 1.016 1.016)))) + ) + (pin bidirectional line (at -38.1 10.16 0) (length 5.08) + (name "AD1/DIO1" (effects (font (size 1.016 1.016)))) + (number "30" (effects (font (size 1.016 1.016)))) + ) + (pin bidirectional line (at -38.1 12.7 0) (length 5.08) + (name "AD0/DIO0" (effects (font (size 1.016 1.016)))) + (number "31" (effects (font (size 1.016 1.016)))) + ) + (pin bidirectional line (at 38.1 -15.24 180.0) (length 5.08) + (name "RF" (effects (font (size 1.016 1.016)))) + (number "33" (effects (font (size 1.016 1.016)))) + ) + ) + ) ) diff --git a/PCB/libraries/Xbee3.pretty/XB324Z8UMJ.kicad_mod b/PCB/libraries/Xbee3.pretty/XB324Z8UMJ.kicad_mod new file mode 100644 index 0000000..aa5e111 --- /dev/null +++ b/PCB/libraries/Xbee3.pretty/XB324Z8UMJ.kicad_mod @@ -0,0 +1,119 @@ + +(footprint XB324Z8UMJ (layer F.Cu) (tedit 6AA21478) + (descr "") + (attr smd) + (fp_text reference REF** (at -2.919 -11.4982 0) (layer F.SilkS) + (effects (font (size 1.32 1.32) (thickness 0.15))) + ) + (fp_text value XB324Z8UMJ (at 6.5394 11.4018 0) (layer F.Fab) + (effects (font (size 1.32 1.32) (thickness 0.15))) + ) + (pad 1 smd rect (at -6.5532 -5.842) (size 1.4478 0.8382) (layers F.Cu F.Mask F.Paste) (solder_mask_margin 0.102)) + (pad 2 smd rect (at -6.5532 -4.59232) (size 1.4478 0.8382) (layers F.Cu F.Mask F.Paste) (solder_mask_margin 0.102)) + (pad 3 smd rect (at -6.5532 -3.34264) (size 1.4478 0.8382) (layers F.Cu F.Mask F.Paste) (solder_mask_margin 0.102)) + (pad 4 smd rect (at -6.5532 -2.09296) (size 1.4478 0.8382) (layers F.Cu F.Mask F.Paste) (solder_mask_margin 0.102)) + (pad 5 smd rect (at -6.5532 -0.843281) (size 1.4478 0.8382) (layers F.Cu F.Mask F.Paste) (solder_mask_margin 0.102)) + (pad 6 smd rect (at -6.5532 0.4064) (size 1.4478 0.8382) (layers F.Cu F.Mask F.Paste) (solder_mask_margin 0.102)) + (pad 7 smd rect (at -6.5532 1.65608) (size 1.4478 0.8382) (layers F.Cu F.Mask F.Paste) (solder_mask_margin 0.102)) + (pad 8 smd rect (at -6.5532 2.90576) (size 1.4478 0.8382) (layers F.Cu F.Mask F.Paste) (solder_mask_margin 0.102)) + (pad 9 smd rect (at -6.5532 4.15544) (size 1.4478 0.8382) (layers F.Cu F.Mask F.Paste) (solder_mask_margin 0.102)) + (pad 10 smd rect (at -6.5532 5.40512) (size 1.4478 0.8382) (layers F.Cu F.Mask F.Paste) (solder_mask_margin 0.102)) + (pad 11 smd rect (at -6.5532 6.6548) (size 1.4478 0.8382) (layers F.Cu F.Mask F.Paste) (solder_mask_margin 0.102)) + (pad 12 smd rect (at -6.5532 7.90448) (size 1.4478 0.8382) (layers F.Cu F.Mask F.Paste) (solder_mask_margin 0.102)) + (pad 13 smd rect (at -4.3815 9.4361) (size 0.8382 1.4478) (layers F.Cu F.Mask F.Paste) (solder_mask_margin 0.102)) + (pad 14 smd rect (at -3.13182 9.4361) (size 0.8382 1.4478) (layers F.Cu F.Mask F.Paste) (solder_mask_margin 0.102)) + (pad 15 smd rect (at -1.88214 9.4361) (size 0.8382 1.4478) (layers F.Cu F.Mask F.Paste) (solder_mask_margin 0.102)) + (pad 16 smd rect (at -0.632459 9.4361) (size 0.8382 1.4478) (layers F.Cu F.Mask F.Paste) (solder_mask_margin 0.102)) + (pad 17 smd rect (at 0.617219 9.4361) (size 0.8382 1.4478) (layers F.Cu F.Mask F.Paste) (solder_mask_margin 0.102)) + (pad 18 smd rect (at 1.8669 9.4361) (size 0.8382 1.4478) (layers F.Cu F.Mask F.Paste) (solder_mask_margin 0.102)) + (pad 19 smd rect (at 3.11658 9.4361) (size 0.8382 1.4478) (layers F.Cu F.Mask F.Paste) (solder_mask_margin 0.102)) + (pad 20 smd rect (at 4.3815 9.4361) (size 0.8382 1.4478) (layers F.Cu F.Mask F.Paste) (solder_mask_margin 0.102)) + (pad 21 smd rect (at 6.5532 7.90448) (size 1.4478 0.8382) (layers F.Cu F.Mask F.Paste) (solder_mask_margin 0.102)) + (pad 22 smd rect (at 6.5532 6.6548) (size 1.4478 0.8382) (layers F.Cu F.Mask F.Paste) (solder_mask_margin 0.102)) + (pad 23 smd rect (at 6.5532 5.40512) (size 1.4478 0.8382) (layers F.Cu F.Mask F.Paste) (solder_mask_margin 0.102)) + (pad 24 smd rect (at 6.5532 4.15544) (size 1.4478 0.8382) (layers F.Cu F.Mask F.Paste) (solder_mask_margin 0.102)) + (pad 25 smd rect (at 6.5532 2.90576) (size 1.4478 0.8382) (layers F.Cu F.Mask F.Paste) (solder_mask_margin 0.102)) + (pad 26 smd rect (at 6.5532 1.65608) (size 1.4478 0.8382) (layers F.Cu F.Mask F.Paste) (solder_mask_margin 0.102)) + (pad 27 smd rect (at 6.5532 0.4064) (size 1.4478 0.8382) (layers F.Cu F.Mask F.Paste) (solder_mask_margin 0.102)) + (pad 28 smd rect (at 6.5532 -0.843281) (size 1.4478 0.8382) (layers F.Cu F.Mask F.Paste) (solder_mask_margin 0.102)) + (pad 29 smd rect (at 6.5532 -2.09296) (size 1.4478 0.8382) (layers F.Cu F.Mask F.Paste) (solder_mask_margin 0.102)) + (pad 30 smd rect (at 6.5532 -3.34264) (size 1.4478 0.8382) (layers F.Cu F.Mask F.Paste) (solder_mask_margin 0.102)) + (pad 31 smd rect (at 6.5532 -4.59232) (size 1.4478 0.8382) (layers F.Cu F.Mask F.Paste) (solder_mask_margin 0.102)) + (pad 32 smd rect (at 6.5532 -5.842) (size 1.4478 0.8382) (layers F.Cu F.Mask F.Paste) (solder_mask_margin 0.102)) + (pad 33 smd rect (at 6.5532 -7.09168) (size 1.4478 0.8382) (layers F.Cu F.Mask F.Paste) (solder_mask_margin 0.102)) + (pad 34 smd rect (at 6.5532 -8.3566) (size 1.4478 0.8382) (layers F.Cu F.Mask F.Paste) (solder_mask_margin 0.102)) + (fp_line (start -6.7691 9.652) (end -6.7691 -9.652) (layer F.Fab) (width 0.127)) + (fp_line (start -6.7691 -9.652) (end 6.7691 -9.652) (layer F.Fab) (width 0.127)) + (fp_line (start 6.7691 -9.652) (end 6.7691 9.652) (layer F.Fab) (width 0.127)) + (fp_line (start 6.7691 9.652) (end -6.7691 9.652) (layer F.Fab) (width 0.127)) + (zone (net 0) (net_name "") (layer F.Cu) (hatch full 0.508) + (connect_pads (clearance 0)) + (min_thickness 0.01) + (keepout (tracks not_allowed) (vias not_allowed) (pads not_allowed ) (copperpour not_allowed) (footprints allowed)) + (fill (thermal_gap 0.508) (thermal_bridge_width 0.508)) + (polygon + (pts + (xy 1.1049 -8.382) + (xy 3.6449 -8.382) + (xy 3.6449 -4.572) + (xy 1.1049 -4.572) + ) + ) + ) + (fp_poly + (pts + (xy -25.4 -20.6756) + (xy 25.4 -20.6756) + (xy 25.4 -5.4356) + (xy -25.4 -5.4356) + ) (layer F.CrtYd) (width 0.01) + ) + (zone (net 0) (net_name "") (layer F.Cu) (hatch full 0.508) + (connect_pads (clearance 0)) + (min_thickness 0.01) + (keepout (tracks not_allowed) (vias not_allowed) (pads not_allowed ) (copperpour not_allowed) (footprints allowed)) + (fill (thermal_gap 0.508) (thermal_bridge_width 0.508)) + (polygon + (pts + (xy -25.4 -20.6756) + (xy 25.4 -20.6756) + (xy 25.4 -9.652) + (xy -25.4 -9.652) + ) + ) + ) + (fp_poly + (pts + (xy -25.4 -20.6756) + (xy 25.4 -20.6756) + (xy 25.4 -9.652) + (xy -25.4 -9.652) + ) (layer B.CrtYd) (width 0.01) + ) + (zone (net 0) (net_name "") (layers *.Cu) (hatch full 0.508) + (connect_pads (clearance 0)) + (min_thickness 0.01) + (keepout (tracks allowed) (vias not_allowed) (pads allowed ) (copperpour allowed) (footprints allowed)) + (fill (thermal_gap 0.508) (thermal_bridge_width 0.508)) + (polygon + (pts + (xy -25.4 -20.6756) + (xy 25.4 -20.6756) + (xy 25.4 -9.652) + (xy -25.4 -9.652) + ) + ) + ) + (fp_line (start -6.7691 -6.61) (end -6.7691 -9.652) (layer F.SilkS) (width 0.127)) + (fp_line (start -6.7691 -9.652) (end 6.7691 -9.652) (layer F.SilkS) (width 0.127)) + (fp_line (start 6.7691 -9.652) (end 6.7691 -9.13) (layer F.SilkS) (width 0.127)) + (fp_line (start -6.7691 8.68) (end -6.7691 9.652) (layer F.SilkS) (width 0.127)) + (fp_line (start -6.7691 9.652) (end -5.15 9.652) (layer F.SilkS) (width 0.127)) + (fp_line (start 5.15 9.652) (end 6.7691 9.652) (layer F.SilkS) (width 0.127)) + (fp_line (start 6.7691 9.652) (end 6.7691 8.68) (layer F.SilkS) (width 0.127)) + (fp_line (start -7.53 -5.4356) (end -7.53 10.41) (layer F.CrtYd) (width 0.05)) + (fp_line (start -7.53 10.41) (end 7.53 10.41) (layer F.CrtYd) (width 0.05)) + (fp_line (start 7.53 10.41) (end 7.53 -5.4356) (layer F.CrtYd) (width 0.05)) + (fp_circle (center -8.3 -6.0) (end -8.2 -6.0) (layer F.SilkS) (width 0.2)) + (fp_circle (center -8.3 -6.0) (end -8.2 -6.0) (layer F.Fab) (width 0.2)) +) \ No newline at end of file diff --git a/PCB/snips_controller.kicad_pro b/PCB/snips_controller.kicad_pro index 1d8bceb..ec4b7aa 100644 --- a/PCB/snips_controller.kicad_pro +++ b/PCB/snips_controller.kicad_pro @@ -680,7 +680,7 @@ "uuid": "21935953-32a0-46ad-8079-8177920c6978" } ], - "used_designators": "U_ACCEL1,R_ISET1,U_OLED1,SW_THR_DN1,SW_THR_UP1,R_XBEE_RST1,PF_VBUS1,J_USB1,PF_VBAT1,Q_PWR1,R_USB_DP1,R_RGB1,R_GATE1,C_RGB1,R_I2C_SCL1,U_BUCK1,SW_TRIG_DIG1,R_TS1,SW_PWR1,R_XBEE_RC1,PF_GND1,R_I2C_SDA1,SW_VOL_UP1,R_VSET1,R_BTN_PU1,C_BUCK_IN1,R_PWR_SENSE1,L_BUCK1,SW_BOOT1,R_EN_PU1,PF_VSYS1,U_CHG1,R_BOOT_PU1,R_USB_DM1,U_XBEE1,C_STICK1,R_LATCH_G1,D_RGB1,SW_VOL_DN1,Q_LATCH1,C_HALL1,U_HALL1,C_XBEE_VCC1,C_BUCK_OUT1,C_XBEE_RC1,C_DBNC1,J_STICK1,C_BAT1,U_MCU1", + "used_designators": "R_ISET1,U_OLED1,SW_THR_DN1,SW_THR_UP1,R_XBEE_RST1,PF_VBUS1,J_USB1,PF_VBAT1,Q_PWR1,R_USB_DP1,R_RGB1,R_GATE1,C_RGB1,R_I2C_SCL1,U_BUCK1,SW_TRIG_DIG1,R_TS1,SW_PWR1,R_XBEE_RC1,PF_GND1,C_BUCK_IN1,R_PWR_SENSE1,R_VSET1,R_I2C_SDA1,SW_VOL_UP1,R_BTN_PU1,SW_BOOT1,R_EN_PU1,U_ACCEL1,PF_VSYS1,U_CHG1,R_BOOT_PU1,R_USB_DM1,U_XBEE1,C_STICK1,R_LATCH_G1,SW_VOL_DN1,D_RGB1,U_HALL1,Q_LATCH1,L_BUCK1,C_HALL1,C_DBNC1,C_XBEE_VCC1,C_BUCK_OUT1,C_XBEE_RC1,U_MCU1,C_BAT1,J_STICK1", "variants": [] }, "sheets": [ diff --git a/include/low_battery.h b/include/low_battery.h index 9c28966..ab688aa 100644 --- a/include/low_battery.h +++ b/include/low_battery.h @@ -2,11 +2,12 @@ #include "screen.h" -// Pure logic for the low-battery warning and safe-shutdown countdown. -// Knows nothing about real hardware — SnipsController.ino feeds in the -// already-computed battery percent/charge state each tick and applies -// the real effects (forcing the OLED on, blinking it and the status LED, -// sleeping the XBee, and calling performGracefulShutdown()). +// Pure logic and screen content for battery/charging safety: the +// low-battery warning and safe-shutdown countdown, plus the charging +// fault message. Knows nothing about real hardware — SnipsController.ino +// feeds in the already-computed battery percent/charge state each tick +// and applies the real effects (forcing the OLED on, blinking it and the +// status LED, sleeping the XBee, and calling performGracefulShutdown()). namespace BatteryThresholds { // Below this (and above critical), the battery indicator and status LED @@ -84,3 +85,13 @@ void renderLowBatteryCountdownScreen(int secondsRemaining, // countdown — no session has started yet) if the battery is already at // or below kCriticalPercent the moment the device is turned on. void renderBatteryEmptyScreen(ScreenBuffer *screen); + +// Fills `screen` with the charging-fault message. SnipsController.ino +// shows this whenever ChargeState::kLatchedFault is active (BATOCP, +// ILIM/ISET pin short, or safety timer expired — see bq25185 datasheet +// Table 7-2). Per that datasheet, the *only* way to clear this fault is +// toggling the CE pin or input power — this board's CE is hardwired to +// GND (always-enable, no firmware control — see +// PCB/snips_controller.yaml's Power_Charger section), so unplugging and +// replugging the charge cable is the only recovery a user actually has. +void renderChargingFaultScreen(ScreenBuffer *screen); diff --git a/src/SnipsController.ino b/src/SnipsController.ino index 1025860..4f139d0 100644 --- a/src/SnipsController.ino +++ b/src/SnipsController.ino @@ -589,7 +589,18 @@ void loop() { if (menuController.currentScreen() == MenuScreen::kInactive && !lowBatteryMonitor.isInShutdownCountdown()) { - showOperatingScreen(); + // A charging fault takes over the operating screen (but not active + // menu navigation) for as long as it persists — this checks once a + // second like the rest of this block rather than every tick, since + // unlike the bounded 30-second countdown above, a fault can persist + // for an entire session and redrawing every tick would hog I2C. + if (chargeState == ChargeState::kLatchedFault) { + ScreenBuffer faultScreen; + renderChargingFaultScreen(&faultScreen); + oledDisplay.render(faultScreen); + } else { + showOperatingScreen(); + } } Serial.print("Battery "); diff --git a/src/low_battery.cpp b/src/low_battery.cpp index b2a9374..99f3b17 100644 --- a/src/low_battery.cpp +++ b/src/low_battery.cpp @@ -74,3 +74,10 @@ void renderBatteryEmptyScreen(ScreenBuffer *screen) { screen->setLine(0, "Battery Empty"); screen->setLine(1, "Please charge"); } + +void renderChargingFaultScreen(ScreenBuffer *screen) { + screen->clear(); + screen->setLine(0, "Charging Fault!"); + screen->setLine(1, "Unplug & replug"); + screen->setLine(2, "charger"); +} diff --git a/test/test_low_battery/test_low_battery.cpp b/test/test_low_battery/test_low_battery.cpp index 60dcf50..5386d0a 100644 --- a/test/test_low_battery/test_low_battery.cpp +++ b/test/test_low_battery/test_low_battery.cpp @@ -147,6 +147,14 @@ void test_render_battery_empty_screen() { TEST_ASSERT_EQUAL_STRING("Please charge", screen.line(1)); } +void test_render_charging_fault_screen() { + ScreenBuffer screen; + renderChargingFaultScreen(&screen); + TEST_ASSERT_EQUAL_STRING("Charging Fault!", screen.line(0)); + TEST_ASSERT_EQUAL_STRING("Unplug & replug", screen.line(1)); + TEST_ASSERT_EQUAL_STRING("charger", screen.line(2)); +} + int main(int argc, char **argv) { UNITY_BEGIN(); RUN_TEST(test_no_warning_above_ten_percent); @@ -164,5 +172,6 @@ int main(int argc, char **argv) { RUN_TEST(test_render_countdown_screen_shows_message_and_seconds); RUN_TEST(test_render_countdown_screen_updates_seconds); RUN_TEST(test_render_battery_empty_screen); + RUN_TEST(test_render_charging_fault_screen); return UNITY_END(); }