Skip to content

Commit

Permalink
outlet_eco_yes_no_info move to mge-xml.c
Browse files Browse the repository at this point in the history
Signed-off-by: DaRK AnGeL <[email protected]>
  • Loading branch information
masterwishx committed Sep 24, 2024
1 parent e7145d7 commit 3028e77
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
8 changes: 1 addition & 7 deletions drivers/mge-hid.c
Original file line number Diff line number Diff line change
Expand Up @@ -689,12 +689,6 @@ static info_lkp_t pegasus_yes_no_info[] = {
{ 0, NULL, NULL, NULL }
};

static info_lkp_t outlet_eco_yes_no_info[] = {
{ 0, "The outlet is not ECO controlled", pegasus_yes_no_info_fun, pegasus_yes_no_info_nuf },
{ 1, "The outlet is ECO controlled", pegasus_yes_no_info_fun, pegasus_yes_no_info_nuf },
{ 0, NULL, NULL, NULL }
};

/* Determine country using UPS.PowerSummary.Country.
* If not present:
* if PowerConverter.Output.Voltage >= 200 => "Europe"
Expand Down Expand Up @@ -1533,7 +1527,7 @@ static hid_info_t mge_hid2nut[] =
{ "outlet.2.current", 0, 0, "UPS.OutletSystem.Outlet.[3].Current", NULL, "%.2f", 0, NULL },
{ "outlet.2.powerfactor", 0, 0, "UPS.OutletSystem.Outlet.[3].PowerFactor", NULL, "%.2f", 0, NULL }, /* "%s", 0, mge_powerfactor_conversion }, */
/* 0: The outlet is not ECO controlled. / 1 : The outlet is ECO controlled. => Readonly! use some yes_no_info */
{ "outlet.2.ecocontrol", 0, 0, "UPS.OutletSystem.Outlet.[3].ECOControl", NULL, "%s", HU_FLAG_SEMI_STATIC, eco_pegasus_yes_no_info},
{ "outlet.2.ecocontrol", 0, 0, "UPS.OutletSystem.Outlet.[3].ECOControl", NULL, "%s", HU_FLAG_SEMI_STATIC, outlet_eco_yes_no_info},

/* instant commands. */
/* splited into subset while waiting for extradata support
Expand Down
14 changes: 14 additions & 0 deletions drivers/mge-xml.c
Original file line number Diff line number Diff line change
Expand Up @@ -411,6 +411,20 @@ static const char *yes_no_info(const char *arg_val)
}
}

static const char *outlet_eco_yes_no_info(const char *arg_val)
{
switch(arg_val[0])
{
case '1':
return "The outlet is ECO controlled";
case '0':
return "The outlet is not ECO controlled";
default:
upsdebugx(2, "%s: unexpected value [%s]", __func__, arg_val);
return "<unknown>";
}
}

static const char *on_off_info(const char *arg_val)
{
switch(arg_val[0])
Expand Down

0 comments on commit 3028e77

Please sign in to comment.