-
Notifications
You must be signed in to change notification settings - Fork 4
Meter Buttons and Modes
This page describes the meter's buttons and switches. After are the meter's measurement modes and the transitions between them. There are also references to functions and variables in the decompilation which control the relevant behavior.
The meter has three user input methods: The 8 range switch positions, the 8 buttons, and the 2 jack position sensors.
The range switch and buttons do not have hardware debouncing (R/C not populated on the schematic), and need internal GPIO pull-ups to be enabled.
The range switch is connected to the lowest 8 bits of GPIOG. The leftmost switch position is connected to GPIOG7 and the rightmost to GPIOG0, with the middle as expected. The switch inputs are active low.
The current range switch state is read into curr_range_switch_bits
by read_range_switch()
. These values are active-high and reversed, so that bit 0 is the leftmost position and bit 7 the rightmost. update_mode_based_on_range_switch()
then reads these bits and sets the new measurement mode accordingly.
The eight buttons are connected to bits 8-15 of GPIOG. The button inputs are active low. The buttons are connected as shown in the table below, along with their enumeration values.
IDA Constant Name | Value | Pin |
---|---|---|
BTN_MODE |
0x01 | GPIOG8 |
BTN_SETUP |
0x02 | GPIOG9 |
BTN_MINMAX |
0x04 | GPIOG10 |
BTN_MEM |
0x08 | GPIOG11 |
BTN_RANGE |
0x10 | GPIOG12 |
BTN_HOLD |
0x20 | GPIOG13 |
BTN_REL |
0x40 | GPIOG14 |
BTN_PEAK |
0x80 | GPIOG15 |
The button states are read by read_buttons()
. The buttons are ORed together using the values in the table above. The currently pressed buttons are stored in buttons_pressed
, and currently held buttons are stored in buttons_held
. If new buttons were pressed or held, the functions update_based_on_pressed_buttons(buttons)
and update_based_on_held_buttons(buttons)
are called as appropriate to act on the change. Those two functions can also be called if a button press or hold command is received over the Bluetooth link.
The meter has two sensors that detect if there is a lead in the mA jack or the A jack. These are used to alert the user if the lead position is incorrect and to automatically switch between mA and A modes. The mA sensor is attached to GPIOE10 and the A sensor to GPIOE11. Both are active low. The function read_amp_lead_pos_and_update()
is called to read the sensors and change modes or alert the user as appropriate.
The current measurement mode controls what figure is measured and displayed. The firmware stores the current mode in curr_meas_mode
. Additionally, the current range is stored in curr_meas_range
. The current measurement mode is stored in EEPROM for each range switch position. The table below contains the list of mode names used in IDA, along with their index. The table also does not contain 'protocol modes', which are modes sent in the Bluetooth packet. The calibration table in the official manual conveniently details the available ranges in each mode and their index. It is correct, except for the power ranges, capacitance, and temperature. (TODO: correct it)
IDA Constant Name | Value |
---|---|
MM_LOW_Z |
0 |
MM_DCV |
1 |
MM_ACV |
2 |
MM_DCmV |
3 |
MM_ACmV |
4 |
MM_TEMP |
5 |
MM_HZ |
6 |
MM_mSEC |
7 |
MM_DUTY |
8 |
MM_OHMS |
9 |
MM_CONTINUITY |
10 |
MM_DIODE |
11 |
MM_CAP |
12 |
MM_ACuVA |
13 |
MM_ACmVA |
14 |
MM_ACVA |
15 |
MM_ACuA |
16 |
MM_DCuA |
17 |
MM_ACmA |
18 |
MM_DCmA |
19 |
MM_ACA |
20 |
MM_DCA |
21 |
MM_DCuVA |
22 |
MM_DCmVA |
23 |
MM_DCVA |
24 |
The current mode can be changed by moving the range switch, pressing the MODE key, or changing the position of the current lead. Each item in the list below is a list of transitions for a particular range switch position, starting with the leftmost. The first mode is the default one for that position.
- Low Z
- DCV -> ACV -> DCV/ACV
- DCmV -> ACmV -> Temp
- Hz -> mSec -> Duty
- Ohms -> Continuity -> Diode -> Cap
- DCVA -> ACVA and DCmVA -> ACmVA (switch determined by position of current lead)
- DCuA -> ACuA -> DCuVA -> ACuVA
- DCmA -> ACmA and DCA -> ACA (switch determined by position of current lead)
-
update_display()
does everything related to updating the segments -
meter_process_range_mode_changed()
is called whenever the main mode or range are changed -
hy_read_regs_and_process_ints()
is where measurement processing is started
The subscreen also displays measurements and system information. It, too, has several modes, plus three SPL (special) modes whose meaning depends on the current mode.
IDA Constant Name | Value | Meaning |
---|---|---|
SM_TEMP |
0 | Current internal temperature |
SM_BATTERY |
1 | Current battery level |
SM_APO |
2 | Auto Power Off status |
SM_CONTRAST |
3 | LCD screen contrast |
SM_YEAR |
4 | Current year |
SM_MONTH_DAY |
5 | Current month (left) and day (right) |
SM_HOUR_MINUTE |
6 | Current hour (left) and minute (right) |
SM_METER_SERIAL |
7 | Current serial number, used to disambiguate meters over Bluetooth. Is it related to the real serial number? It can be changed. |
SM_LOG_INTERVAL |
8 | Seconds between log entries |
SM_SPL1 |
9 | First mode-dependent display |
SM_SPL2 |
10 | Second mode-dependent display |
SM_SPL3 |
11 | Third mode-dependent display |
SM_LOG_POS |
100 | Sample number during log recording or playback |
Subscreen modes are selected by pressing the SETUP key. The order is as displayed in the above table, skipping SPL ranges if not valid for the current mode. The displayed mode can be edited (if appropriate) by holding the SETUP key. A default subscreen mode is selected whenever the range is changed. For most ranges, this is temperature. For ranges with an SPL display, this is SPL1. The SM_LOG_POS
mode is only used during logging and cannot be selected at any other time.
- ACV (not including AC+DC)
- SPL1 displays input frequency in Hz
- SPL2 displays voltage level in dBm.
- Power (all VA ranges)
- SPL1 alternates periodically between input volts and amps
- SPL2 is burden voltage display enable
- SPL3 is burden voltage display (if enabled), but it's bugged. The displayed burden voltage is actually the input amps. Is it even possible to measure burden and power at the same time? I would think this would need a second voltage input. Perhaps this can be fixed, but it seems impossible for the hardware.
- AC Current (all ranges)
- SPL1 is burden voltage display enable
- SPL2 is burden voltage, if enabled, or input frequency if not
- SPL3 would be Hz if burden voltage is enabled, but it cannot be accessed. This can probably be patched, unless the hardware can't measure Hz with voltage and current.
- DC Current (all ranges)
- SPL1 is burden voltage display enable
- SPL2 is burden voltage, if enabled
- Diode: SPL1 is the test voltage
- Continuity: SPL1 is the range and open/short mode
- ACmV: SPL1 is input frequency
-
update_subscr()
sets the subscreen's displayed value according to its mode -
subscr_update_units()
sets the various unit and mode segments on the subscreen according to its mode -
meter_incr_subscr_mode()
is called when SETUP is pressed to change the subscreen mode -
meter_set_default_subscr_mode()
is called when the main mode or range is changed and does what it says -
setup_menu_button_pressed(button)
is called when a button is pressed in a setup context in order to edit a value