summaryrefslogtreecommitdiff
path: root/openpicc/application/cmd.c
diff options
context:
space:
mode:
authorhenryk <henryk@6dc7ffe9-61d6-0310-9af1-9938baff3ed1>2007-11-23 18:06:33 +0000
committerhenryk <henryk@6dc7ffe9-61d6-0310-9af1-9938baff3ed1>2007-11-23 18:06:33 +0000
commit81d6f89003199f3577cd5214b2a2ddd216c9acc0 (patch)
tree6f10d1a77f7d1488acf9c7fa3c7b3774474b10ed /openpicc/application/cmd.c
parentaa804cf4ef8ed3236ae0065952d1faef735b3824 (diff)
Add scale values to the field meter
git-svn-id: https://svn.openpcd.org:2342/trunk@349 6dc7ffe9-61d6-0310-9af1-9938baff3ed1
Diffstat (limited to 'openpicc/application/cmd.c')
-rw-r--r--openpicc/application/cmd.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/openpicc/application/cmd.c b/openpicc/application/cmd.c
index d8a88df..6e5230e 100644
--- a/openpicc/application/cmd.c
+++ b/openpicc/application/cmd.c
@@ -426,6 +426,7 @@ void vCmdRecvUsbCode(void *pvParameters) {
static portBASE_TYPE field_meter_enabled = 0;
#define FIELD_METER_WIDTH 80
#define FIELD_METER_MAX_VALUE 160
+#define FIELD_METER_SCALE_FACTOR (FIELD_METER_MAX_VALUE/FIELD_METER_WIDTH)
// A task to print the field strength as a bar graph
void vFieldMeter(void *pvParameters) {
(void) pvParameters;
@@ -438,8 +439,10 @@ void vFieldMeter(void *pvParameters) {
for(i=0; i<FIELD_METER_WIDTH; i++)
meter_string[i+1] =
- (ad_value / (FIELD_METER_MAX_VALUE/FIELD_METER_WIDTH) < i) ?
- ' ' : '#';
+ (ad_value / FIELD_METER_SCALE_FACTOR < i) ?
+ ' ' :
+ ((i*FIELD_METER_SCALE_FACTOR)%10==0 ?
+ (((i*FIELD_METER_SCALE_FACTOR)/10)%10)+'0' : '#' );
meter_string[i+1] = 0;
usb_print_string(meter_string);
personal git repositories of Harald Welte. Your mileage may vary