Merge branch 'main' of git.zander.im:Zander671/rpi4b-temp-humidity

This commit is contained in:
Alexander Rosenberg 2024-04-10 19:16:59 -07:00
commit 8fac0dfcfd
Signed by: school-rpi4
GPG Key ID: 5CCFC80B0B47B04B
6 changed files with 50 additions and 21 deletions

View File

@ -193,14 +193,6 @@ armstub=armstub8-gic.bin
enable_uart=1
```
Then enable the `ntpd` and `ntpdate` services to sync with the RTC on boot and
periodically:
```sh
service ntpd enable
service ntpdate enable
```
If you want, you can also change the `root` password at this point:
```sh
@ -214,7 +206,15 @@ sysctl dev.ds3231.0.temperature dev.gpioths.0.temperature
```
If you get a warning about an unknown oid, it means that the sensor is not
installed or configured correctly.
installed or configured correctly. The following commands can help in debugging
the problem. For example, if the battery in the DS3231 has gone bad, the above
command will show no error, however, the below command will print a warning
message.
```sh
dmesg | grep -i ds3231 # for ds3231 debugging
dmesg | grep -i gpioths # for temperature sensor debugging
```
It should be noted that FreeBSD does not currently support wireless on the
Raspberry Pi 4 at the time of writing. Thus, you will need to use a wired
@ -242,6 +242,15 @@ tar xf main.tar.gz
cd rpi4b-temp-humidity
```
If you do plan on connecting the device to the internet long term (remember to
arrange for it to be updated!!!), you can enable the ntpd and ntpdate services
to sync with an NTP server.
```sh
service ntpd enable # sync periodically
service ntpdate enable # sync on boot
```
At this point, take a moment to edit the `config.mk` file to to change any
default options. These can also be changed after installation by editing
`/usr/local/etc/rpi4b-temp-humidity/config.conf`.
@ -290,5 +299,31 @@ The buttons from closest to the display to farthest are: select, back, up, and
down. When the device first turns on, the stats screen will be shown. This screen
displays the current temperature, humidity, and time. Pressing the back button
will take you to the main menu. The following is a short description of each screen:
- "Stats by" screen shows stats by a specific period (e.g. hour, day, week)
-
- *Current stats* - the current time, temperature, and humidity
- *Stats by* - show stats by a specific period (e.g. hour, day, week). Press
the select button while on a stats screen to cycle what is displayed. Use up
and down while on a stats screen to got to the next or previous period.
- *Data points* - view individual data points. Press up or down to go to the next
or previous data point.
- *Average range* - show stats between two times. This has the same controls as
the "Stats by" screen above.
- *Export* - export data to a plugged in USB drive. Only file-systems detected by
[fstyp(8)][11] are supported. If a drive with an unsupported file-system, or
no file-system, is selected, you will be prompted to format it as FAT32.
- *Blank display* - turn of the display. Press any button to cancel. You must
have specified a "bl_pin" in the config file.
- *Power options* - re-initialize the program, shutdown or reboot the device
- *View date/time* - show the current date and time down to the second
- *Set date/time* - set the current date and time. The time entered is in local
time.
- *Set timezone* - set the timezone. The prompts will guide you through creating a
timezone as described in [tzset(3)][12]. Another, possibly easier to
understand description can be found in the corresponding Linux man page
[tzset(3)][13].
- *Clear data* - *DELETE ALL DATA* on the device. When the operation is complete,
the database will be empty. *NO BACKUP IS MADE* so be careful.
[11]: https://man.freebsd.org/cgi/man.cgi?query=fstyp&manpath=FreeBSD+14.0-RELEASE+and+Ports
[12]: https://man.freebsd.org/cgi/man.cgi?query=tzset&manpath=FreeBSD+14.0-RELEASE+and+Ports
[13]: https://man.archlinux.org/man/tzset.3

View File

@ -10,8 +10,6 @@
#include "lcd.h"
#include "util.h"
#include "ths.h"
#include "button.h"
#include "menu.h"
#include "config.h"
#include "ui/screen.h"
#include "ui/statsby.h"
@ -27,17 +25,13 @@
#include <unistd.h>
#include <err.h>
#include <errno.h>
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <figpar.h>
#include <inttypes.h>
#include <time.h>
#include <sys/time.h>
#include <unistd.h>
#include <pthread.h>
#include <stdatomic.h>
#include <signal.h>
#include <sqlite3.h>
#include <libgen.h>

View File

@ -27,7 +27,7 @@ static bool blank_screen_dispatch(Screen *screen,
Screen *blank_screen_new() {
Screen *s = malloc_checked(sizeof(Screen));
screen_init(s, "Blank Display",
screen_init(s, "Blank display",
(ScreenDispatchFunc) blank_screen_dispatch,
(ScreenCleanupFunc) free);
return s;

View File

@ -155,7 +155,7 @@ static bool data_points_screen_dispatch(DataPointsScreen *screen, SensorState *s
DataPointsScreen *data_points_screen_new() {
DataPointsScreen *s = malloc_checked(sizeof(DataPointsScreen));
screen_init(&s->parent, "Data Points",
screen_init(&s->parent, "Data points",
(ScreenDispatchFunc) data_points_screen_dispatch,
(ScreenCleanupFunc) free);
s->need_redraw = true;

View File

@ -169,7 +169,7 @@ static bool stats_screen_dispatch(StatsScreen *screen, SensorState *state) {
StatsScreen *stats_screen_new() {
StatsScreen *s = malloc_checked(sizeof(StatsScreen));
screen_init(&s->parent, "Current Stats",
screen_init(&s->parent, "Current stats",
(ScreenDispatchFunc) stats_screen_dispatch,
(ScreenCleanupFunc) free);
s->last_humid = 0;

View File

@ -215,7 +215,7 @@ static bool stats_by_screen_dispatch(StatsByScreen *screen,
StatsByScreen *stats_by_screen_new() {
StatsByScreen *s = malloc_checked(sizeof(StatsByScreen));
screen_init(&s->parent, "Stats by...",
screen_init(&s->parent, "Stats by",
(ScreenDispatchFunc) stats_by_screen_dispatch,
(ScreenCleanupFunc) free);
s->need_redraw = true;