Some commandline interface tweaks
* Print as feedback what is being set via the S-command. * Small fix for setting the day of the week. * Changed the printed output of the I-command for consistency.
This commit is contained in:
parent
f627ee5327
commit
0424291736
|
@ -575,37 +575,51 @@ static int uart_thread(struct pt *pt)
|
|||
// 2000
|
||||
year = 2000 + 10 * (arg2 - 0x30) +
|
||||
(arg3 - 0x30);
|
||||
Serial.print("S: Y: ");
|
||||
Serial.println(year);
|
||||
break;
|
||||
case 'M':
|
||||
// set month
|
||||
month = 10 * (arg2 - 0x30) +
|
||||
(arg3 - 0x30);
|
||||
Serial.print("S: M: ");
|
||||
Serial.println(month);
|
||||
break;
|
||||
case 'D':
|
||||
// set day of month
|
||||
day = 10 * (arg2 - 0x30) +
|
||||
(arg3 - 0x30);
|
||||
Serial.print("S: D: ");
|
||||
Serial.println(day);
|
||||
break;
|
||||
case 'd':
|
||||
// set day of week
|
||||
// Sunday == 1, Saturday == 7
|
||||
day_week = arg2;
|
||||
day_week = (arg2 - 0x30);
|
||||
Serial.print("S: d: ");
|
||||
Serial.println(day_week);
|
||||
break;
|
||||
|
||||
case 'h':
|
||||
// set hour (24 hour format)
|
||||
hour = 10 * (arg2 - 0x30) +
|
||||
(arg3 - 0x30);
|
||||
Serial.print("S: h: ");
|
||||
Serial.println(hour);
|
||||
break;
|
||||
case 'm':
|
||||
// set minutes
|
||||
minute = 10 * (arg2 - 0x30) +
|
||||
(arg3 - 0x30);
|
||||
Serial.print("S: m: ");
|
||||
Serial.println(minute);
|
||||
break;
|
||||
case 's':
|
||||
// set seconds
|
||||
second = 10 * (arg2 - 0x30) +
|
||||
(arg3 - 0x30);
|
||||
Serial.print("S: s: ");
|
||||
Serial.println(second);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -632,42 +646,42 @@ static int uart_thread(struct pt *pt)
|
|||
{
|
||||
case 'Y':
|
||||
// get year
|
||||
Serial.print("g: Y: ");
|
||||
Serial.print("G: Y: ");
|
||||
Serial.println(year);
|
||||
break;
|
||||
case 'M':
|
||||
// get month
|
||||
Serial.print("g: M: ");
|
||||
Serial.print("G: M: ");
|
||||
Serial.println(month);
|
||||
break;
|
||||
case 'D':
|
||||
// get day of month
|
||||
Serial.print("g: D: ");
|
||||
Serial.print("G: D: ");
|
||||
Serial.println(day);
|
||||
break;
|
||||
case 'd':
|
||||
// get day of week
|
||||
Serial.print("g: d: ");
|
||||
Serial.print("G: d: ");
|
||||
Serial.println(day_week);
|
||||
break;
|
||||
|
||||
case 'h':
|
||||
// get hour (24 hour format)
|
||||
Serial.print("g: h: ");
|
||||
Serial.print("G: h: ");
|
||||
if (hour < 10)
|
||||
Serial.print(0, DEC);
|
||||
Serial.println(hour);
|
||||
break;
|
||||
case 'm':
|
||||
// get minutes
|
||||
Serial.print("g: m: ");
|
||||
Serial.print("G: m: ");
|
||||
if (minute < 10)
|
||||
Serial.print(0, DEC);
|
||||
Serial.println(minute);
|
||||
break;
|
||||
case 's':
|
||||
// get seconds
|
||||
Serial.print("g: s: ");
|
||||
Serial.print("G: s: ");
|
||||
if (second < 10)
|
||||
Serial.print(0, DEC);
|
||||
Serial.println(second);
|
||||
|
@ -683,13 +697,13 @@ static int uart_thread(struct pt *pt)
|
|||
{
|
||||
case 'c':
|
||||
// get current value
|
||||
Serial.print("g: Ic: ");
|
||||
Serial.print("I: c: ");
|
||||
Serial.println(lightlevel_sample,
|
||||
DEC);
|
||||
break;
|
||||
case 'a':
|
||||
// get average
|
||||
Serial.print("g: Ia: ");
|
||||
Serial.print("I: a: ");
|
||||
Serial.println(lightlevel_avg,
|
||||
DEC);
|
||||
break;
|
||||
|
|
Loading…
Reference in New Issue