Skip to content

Commit

Permalink
Merge to 1.0.3 Meha
Browse files Browse the repository at this point in the history
  • Loading branch information
redraz committed Jan 19, 2024
1 parent 04bb793 commit a2907d7
Show file tree
Hide file tree
Showing 16 changed files with 521 additions and 559 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ include $(DEVKITPRO)/libnx/switch_rules
# of a homebrew executable (.nro). This is intended to be used for sysmodules.
# NACP building is skipped as well.
#---------------------------------------------------------------------------------
APP_TITLE := Ultra Monitor
APP_VERSION := 1.0.1
APP_TITLE := Status Monitor
APP_VERSION := 1.0.3
TARGET := $(notdir $(CURDIR))
BUILD := build
SOURCES := source
Expand Down
6 changes: 4 additions & 2 deletions config/status-monitor/config.ini.template
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
[status-monitor]
key_combo=L+R+DUP
battery_avg_iir_filter=false
battery_time_left_refreshrate=60

[full]
refresh_rate=1
Expand Down Expand Up @@ -51,5 +53,5 @@ fps_counter_color=#4444
border_color=#F77F
dashed_line_color=#8888
main_line_color=#FFFF
rounded_line_color=#0C0F
perfect_line_color=#F0FF
rounded_line_color=#F0FF
perfect_line_color=#0C0F
3 changes: 3 additions & 0 deletions docs/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ Colors are provided in RGBA4444 format, which means that each character represen
| Key | Explanation | Possible values | Default Value |
|-----|-------------|-----------------|---------------|
| `key_combo` | Buttons combination that allows exiting Full, Mini and Micro modes; max 4 buttons, otherwise next buttons will be ignored. Combine different buttons with `+` | `A`, `B`, `X`, `Y`, `L`, `R`, `ZL`, `ZR`, `PLUS`, `MINUS`, `DUP`, `DDOWN`, `DLEFT`, `DRIGHT`, `SL`, `SR`, `LSTICK`, `RSTICK`, `UP`, `DOWN`, `LEFT`, `RIGHT` | `L+DDOWN+RSTICK` |
| `battery_avg_iir_filter` | Read voltage + current averages directly from fuel gauge, that uses infinite impulse response filter | `true`, `false` | `false` |
| `battery_time_left_refreshrate` | How many seconds must pass to refresh Battery Remaining Time | from `1` to `60` | `60` |


> [full]
Expand Down
47 changes: 30 additions & 17 deletions docs/modes.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,27 @@ For additional functions you need to install:

This mode you can know from older releases of Status Monitor. It contains all informations properly described and supported with high precision.

| Category | Format | Explanation |
|-----------|-------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| CPU Usage | Frequency: %.1f (Δ%+.1f)<br>Core #0: %.2f<br>Core #1: %.2f<br>Core #2: %.2f<br>Core #3: %.2f | Targete clockrate of all CPU cores in MHz (^1)<br>Load of CPU Core #0 calculated from IdleTickCount to percent value<br>Load of CPU Core #1 calculated from IdleTickCount to percent value<br>Load of CPU Core #2 calculated from IdleTickCount to percent value<br>Load of CPU Core #3 calculated from IdleTickCount to percent value |
| GPU Usage | Frequency: %.1f (Δ%+.1f)<br>Load: %.1f | Target clockrate of GPU in MHz (^1)<br>GPU Load provided by PMU in percent |
| RAM Usage | - Real Frequency: %.1f (Δ%+.1f)<br>- Target Frequency: %.1f<br>- Load: %.1f (CPU %.1f \| GPU %.1f)`^1`<br>- %s: %.2f/%.2f | - Real clockrate of EMC in MHz `(^1)`<br>- Target clockrate of EMC in MHz<br>- RAM Load in % (Which part of that are CPU and GPU (with other hardware, but their impact on GPU readings is negligible) `(^1)`<br>- %s memory used/%s memory available in MB (not working with FW <5.0.0) |
| Board | Battery Power Flow: %+.2f[h:mm]<br>Temperatures:<br>- SoC: %.1f <br>- PCB: %.1f <br>- Skin: %.1f<br>Fan Rotation Level: %.1f | How much power in watts is discharged from or charged to the battery [time left before shutdown]<br>SoC temperature in Celsius degrees<br>PCB temperature in Celsius degrees<br>Skin temperature in Celsius degrees (^2)<br>Fan rotation level in percent |

- ^1 - This shows only when sys-clk 2.0.0_rc4+ is installed.
- ^2 - Explanation provided at the end of file
- CPU Usage
- Real Frequency: `%.1f` = Real clockrate of all CPU cores in MHz (This shows only when sys-clk 2.0.0_4c+ is installed)
- Target Frequency: `%.1f` = Target clockrate of all CPU cores in MHz
- Core #0-#3: `%.2f` = Load of CPU Cores calculated from IdleTickCount to percent value

- GPU Usage
- Real Frequency: `%.1f` = Real clockrate of GPU in MHz (This shows only when sys-clk 2.0.0_rc4+ is installed)
- Target Frequency: `%.1f` = Target clockrate of GPU in MHz
- Load: `%.1f` = GPU Load provided by PMU in percent

- RAM Usage
- Real Frequency: `%.1f` = Real clockrate of EMC in MHz (This shows only when sys-clk 2.0.0_rc4+ is installed)
- Target Frequency: `%.1f` = Target clockrate of EMC in MHz
- Load: `%.1f` (CPU `%.1f` | GPU `%.1f`) = RAM Load in % (Which part of that are CPU and GPU (with other hardware, but their impact on GPU readings is negligible))
- `%s`: `%.2f`/`%.2f` = %s memory used/%s memory available in MB (not working with FW <5.0.0)

- Board
- Battery Power Flow: `%+.2f`[h:mm] = How much power in watts is discharged from or charged to the battery [time left before shutdown]
- Temperatures: SoC: `%.1f` / PCB: `%.1f` / Skin: `%.1f` = SoC / PCB / Skin temperature in Celsius degrees (Explanation provided at the end of file)
- Fan Rotation Level: `%.1f` = Fan rotation level in percent


```Optional (shows only when SaltyNX is installed and game is running)```

Expand Down Expand Up @@ -102,14 +114,15 @@ Mode available only with SaltyNX installed.

> Battery
| Category | Format | Explanation |
|---------------------------------|-----------|-----------------------------------------------------------------------------------------------|
| Battery Temperature | %.2f | Battery temperature in Celsius |
| Battery Raw Charge | %.2f | Raw battery charged capacity in percent |
| Battery Voltage (AVG of 5) | %.2f | Battery average voltage in mV taken from 5 readings in period of 5 seconds |
| Battery Current Flow (AVG of 5) | %+.2f | Battery average current flow in mA taken from 5 readings in period of 5 seconds |
| Battery Power Flow (AVG of 5) | %+.3f | Battery average power flow in W calciulated from Battery Voltage and Battery Current Flow |
| Battery Remaining Time | h:mm | How much time is left before shutdown |
- Battery Actual Capacity: `%d` = Battery Designed Capacity multiplied by Battery Age in mAh
- Battery Designed Capacity: `%d` = Battery capacity targeted by manufacturer in mAh
- Battery Temperature: `%.1f` = Battery temperature in Celsius
- Battery Raw Charge: `%.1f` = Raw battery charged capacity in percent
- Battery Age: `%.1f` = How much of designed capacity was charged last time battery was charged completely in percent
- Battery Voltage: `%.0f` = Battery average voltage in mV (time period: 5s, or with `battery_avg_iir_filter` enabled: 45s)
- Battery Current Flow: `%+.0f` = Battery average current flow in mA (time period: 5s, or with `battery_avg_iir_filter` enabled: 11.25s)
- Battery Power Flow: `%+.3f` = Battery average power flow in W calculated from Battery Voltage and Battery Current Flow
- Battery Remaining Time: h:mm - How much time is left before shutdown

Shows only if charger is connected:
| Category | Format | Explanation |
Expand Down
41 changes: 23 additions & 18 deletions include/i2c.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,47 +10,52 @@ constexpr float max17050CGain = 1.99993;

Result I2cReadRegHandler(u8 reg, I2cDevice dev, u16 *out)
{
// I2C Bus Communication Reference: https://www.ti.com/lit/an/slva704/slva704.pdf
struct { u8 reg; } __attribute__((packed)) cmd;
struct { u16 val; } __attribute__((packed)) rec;
struct readReg {
u8 send;
u8 sendLength;
u8 sendData;
u8 receive;
u8 receiveLength;
};

I2cSession _session;

Result res = i2cOpenSession(&_session, dev);
if (res)
return res;

cmd.reg = reg;
res = i2csessionSendAuto(&_session, &cmd, sizeof(cmd), I2cTransactionOption_All);
if (res)
{
i2csessionClose(&_session);
return res;
}
u16 val;

res = i2csessionReceiveAuto(&_session, &rec, sizeof(rec), I2cTransactionOption_All);
struct readReg readRegister = {
.send = 0 | (I2cTransactionOption_Start << 6),
.sendLength = sizeof(reg),
.sendData = reg,
.receive = 1 | (I2cTransactionOption_All << 6),
.receiveLength = sizeof(val),
};

res = i2csessionExecuteCommandList(&_session, &val, sizeof(val), &readRegister, sizeof(readRegister));
if (res)
{
i2csessionClose(&_session);
return res;
}

*out = rec.val;
*out = val;
i2csessionClose(&_session);
return 0;
}

bool Max17050ReadReg(u8 reg, u16 *out)
Result Max17050ReadReg(u8 reg, u16 *out)
{
u16 data = 0;
Result res = I2cReadRegHandler(reg, I2cDevice_Max17050, &data);

if (res)
if (R_FAILED(res))
{
*out = res;
return false;
return res;
}

*out = data;
return true;
}
return res;
}
2 changes: 2 additions & 0 deletions include/max17050.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@
#define MAXIM17050_I2C_ADDR 0x36
*/

#define MAX17050_WAIT_NS 1175800000


enum MAX17050_reg {
MAX17050_STATUS = 0x00,
Expand Down
Loading

0 comments on commit a2907d7

Please sign in to comment.