forked from pyrovski/watts-up
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
1,818 additions
and
1,781 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
TAGS | ||
*~ | ||
*.o | ||
wattsup | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
#include "wattsup_common.h" | ||
|
||
const char * wu_version = "0.03"; | ||
|
||
const char * prog_name = "wattsup"; | ||
|
||
const char * sysfs_path_start = "/sys/class/tty"; | ||
|
||
struct wu_field wu_fields[wu_num_fields] = { | ||
[wu_field_watts] = { | ||
.name = "watts", | ||
.descr = "Watt Consumption", | ||
}, | ||
|
||
[wu_field_min_watts] = { | ||
.name = "min-watts", | ||
.descr = "Minimum Watts Consumed", | ||
}, | ||
|
||
[wu_field_max_watts] = { | ||
.name = "max-watts", | ||
.descr = "Maxium Watts Consumed", | ||
}, | ||
|
||
[wu_field_volts] = { | ||
.name = "volts", | ||
.descr = "Volts Consumption", | ||
}, | ||
|
||
[wu_field_min_volts] = { | ||
.name = "max-volts", | ||
.descr = "Minimum Volts Consumed", | ||
}, | ||
|
||
[wu_field_max_volts] = { | ||
.name = "min-volts", | ||
.descr = "Maximum Volts Consumed", | ||
}, | ||
|
||
[wu_field_amps] = { | ||
.name = "amps", | ||
.descr = "Amp Consumption", | ||
}, | ||
|
||
[wu_field_min_amps] = { | ||
.name = "min-amps", | ||
.descr = "Minimum Amps Consumed", | ||
}, | ||
|
||
[wu_field_max_amps] = { | ||
.name = "max-amps", | ||
.descr = "Maximum Amps Consumed", | ||
}, | ||
|
||
[wu_field_watt_hours] = { | ||
.name = "kwh", | ||
.descr = "Average KWH", | ||
}, | ||
|
||
[wu_field_mo_kwh] = { | ||
.name = "mo-kwh", | ||
.descr = "Average monthly KWH", | ||
}, | ||
|
||
[wu_field_cost] = { | ||
.name = "cost", | ||
.descr = "Cost per watt", | ||
}, | ||
|
||
[wu_field_mo_cost] = { | ||
.name = "mo-cost", | ||
.descr = "Monthly Cost", | ||
}, | ||
|
||
[wu_field_power_factor] = { | ||
.name = "power-factor", | ||
.descr = "Ratio of Watts vs. Volt Amps", | ||
}, | ||
|
||
[wu_field_duty_cycle] = { | ||
.name = "duty-cycle", | ||
.descr = "Percent of the Time On vs. Time Off", | ||
}, | ||
|
||
[wu_field_power_cycle] = { | ||
.name = "power-cycle", | ||
.descr = "Indication of power cycle", | ||
}, | ||
|
||
[wu_field_frequency] = { | ||
.name = "frequency", | ||
.descr = "AC frequency (HZ)", | ||
}, | ||
|
||
[wu_field_va] = { | ||
.name = "VA", | ||
.descr = "VA", | ||
}, | ||
}; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#ifndef CONFIG_H | ||
#define CONFIG_H | ||
|
||
#include "wattsup_common.h" | ||
#include "config.h" | ||
|
||
extern const char * wu_version, | ||
*prog_name, | ||
*sysfs_path_start; | ||
|
||
#define wu_num_options ARRAY_SIZE(wu_options) | ||
|
||
extern struct wu_field wu_fields[]; | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
char * wu_device = "ttyUSB0"; | ||
int wu_fd = 0; | ||
int wu_info_all = 0; | ||
int wu_no_data = 0; | ||
int wu_set_only = 0; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#ifndef GLOBALS_H | ||
#define GLOBALS_H | ||
extern char *wu_device; | ||
extern int wu_fd; | ||
extern int wu_info_all; | ||
extern int wu_no_data; | ||
extern int wu_set_only; | ||
|
||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,9 @@ | ||
all: wattsup | ||
|
||
wattsup: wattsup.c util.c config.c globals.c | ||
|
||
install: all | ||
install -m 0555 wattsup /usr/local/bin | ||
|
||
clean: | ||
rm -f *~ wattsup |
Oops, something went wrong.