Summary Files Commits Branches @commit @diff @stats
path: root / Year 3 / Internet of things / goam / main / main.c
diff options
context:
space:
mode:
Commitc630b3ddebebb7ee5ec3a279939e89a700d8a8ce (patch)
Author
 Syndamia <kamen@syndamia.com>
2024-05-28 11:11:47 +0300
Committer
 Syndamia <kamen@syndamia.com>
2024-05-28 11:11:47 +0300
Files75e0f51d7da970be0366ff797f9db8f375140b1d /Year 3/Internet of things/goam/main/main.c
uni-projects-c630b3ddebebb7ee5ec3a279939e89a700d8a8ce.tar
uni-projects-c630b3ddebebb7ee5ec3a279939e89a700d8a8ce.tar.gz
uni-projects-c630b3ddebebb7ee5ec3a279939e89a700d8a8ce.zip
Parentcea3ffd48f72377c99955e6e02292918fc0608ab (diff)
[iot/goam] Moved display layout to a menuconfig
1 files changed, 25 insertions, 9 deletions
-rw-r--r--Year 3/Internet of things/goam/main/main.c34
diff --git a/Year 3/Internet of things/goam/main/main.c b/Year 3/Internet of things/goam/main/main.c
index 9ed0644..4d44376 100644
--- a/Year 3/Internet of things/goam/main/main.c
+++ b/Year 3/Internet of things/goam/main/main.c
@@ -63,15 +63,23 @@ void print_chip_data() {
static int32_t is = BOTH;
static void display_imagesave() {
+ const char* icon;
switch (is) {
- case SPIFFS_ONLY: display_printat(CHAR_IS_STORE, 1, 7); return;
- case WS_ONLY: display_printat(CHAR_IS_SEND, 1, 7); return;
- case BOTH: display_printat(CHAR_IS_STORE_SEND, 1, 7); return;
+ case SPIFFS_ONLY: icon = CHAR_IS_STORE; break;
+ case WS_ONLY: icon = CHAR_IS_SEND; break;
+ case BOTH: icon = CHAR_IS_STORE_SEND; break;
+ default: return;
}
+ display_printat(icon,
+ CONFIG_DISPLAY_ICONS_ROW,
+ CONFIG_SAVEIMAGE_COLUMN);
}
void main_store_saveimage(int32_t value) {
- if (value < 0 && value > BOTH) return;
+ if (value < 0 && value > BOTH) {
+ ESP_LOGW(TAG, "Invalid value for saveimage was passed, not assigning");
+ return;
+ }
nvs_write_i32("imagesave", value);
is = value;
display_imagesave();
@@ -93,9 +101,11 @@ static void debug_serial_print_image(const char* image, size_t length) {
}
static void take_photo() {
- display_printon(DCHAR_NO_CAMERA, 1);
+ display_printat(DCHAR_NO_CAMERA,
+ CONFIG_DISPLAY_ICONS_ROW,
+ CONFIG_CAMERA_COLUMN);
- ptc06_set_image_resolution(RES_640X480);
+ ptc06_set_image_resolution((enum Resolution)res);
char* image;
size_t length = ptc06_get_image(&image);
if (is != WS_ONLY) {
@@ -105,7 +115,9 @@ static void take_photo() {
ws_send_bin(image, length);
}
- display_printon(DCHAR_CAMERA, 1);
+ display_printat(DCHAR_CAMERA,
+ CONFIG_DISPLAY_ICONS_ROW,
+ CONFIG_CAMERA_COLUMN);
free(image);
}
@@ -124,7 +136,9 @@ static void init_camera(void*) {
ESP_LOGE(TAG, "Couldnt't notify main of camera init, software will hang");
}
- display_printon(DCHAR_CAMERA, 1);
+ display_printat(DCHAR_CAMERA,
+ CONFIG_DISPLAY_ICONS_ROW,
+ CONFIG_CAMERA_COLUMN);
vTaskDelete(NULL);
}
@@ -146,7 +160,9 @@ void app_main(void)
add_push_button(BTN_SHOOT_PIN, take_photo, NULL);
display_init();
- display_printon(DCHAR_NO_CAMERA, 1);
+ display_printat(DCHAR_NO_CAMERA,
+ CONFIG_DISPLAY_ICONS_ROW,
+ CONFIG_CAMERA_COLUMN);
nvs_read_i32("imagesave", &is);
display_imagesave();