forked from flipperdevices/flipperzero-firmware
-
-
Notifications
You must be signed in to change notification settings - Fork 547
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
0 parents
commit c7b7658
Showing
29 changed files
with
2,202 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2022 Oleksii Kutuzov | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
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,17 @@ | ||
## Lightmeter app for photography | ||
|
||
An application that suggests settings for your manual camera based on the reading of the ambient light sensor. Can also be used in a pure lux meter mode. | ||
|
||
## Supported sensors | ||
|
||
- BH1750 | ||
- MAX44009 | ||
|
||
## Wiring | ||
|
||
| Sensor | Flipper Zero | | ||
| ------ | ------------ | | ||
| VCC | 3.3V | | ||
| GND | GND | | ||
| SCL | C0 | | ||
| SDA | C1 | |
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,34 @@ | ||
App( | ||
appid="lightmeter", | ||
name="Lightmeter", | ||
apptype=FlipperAppType.EXTERNAL, | ||
entry_point="lightmeter_app", | ||
requires=[ | ||
"gui", | ||
], | ||
stack_size= 4 * 1024, | ||
order=90, | ||
fap_version=(1, 2), | ||
fap_icon="lightmeter.png", | ||
fap_category="GPIO", | ||
fap_private_libs=[ | ||
Lib( | ||
name="BH1750", | ||
cincludes=["."], | ||
sources=[ | ||
"BH1750.c", | ||
], | ||
), | ||
Lib( | ||
name="MAX44009", | ||
cincludes=["."], | ||
sources=[ | ||
"MAX44009.c", | ||
], | ||
), | ||
], | ||
fap_description="Lightmeter app for photography", | ||
fap_author="Oleksii Kutuzov", | ||
fap_weburl="https://github.com/oleksiikutuzov/flipperzero-lightmeter", | ||
fap_icon_assets="icons", | ||
) |
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,17 @@ | ||
## Lightmeter app for photography | ||
|
||
An application that suggests settings for your manual camera based on the reading of the ambient light sensor. Can also be used in a pure lux meter mode. | ||
|
||
## Supported sensors | ||
|
||
- BH1750 | ||
- MAX44009 | ||
|
||
## Wiring | ||
|
||
| Sensor | Flipper Zero | | ||
| ------ | ------------ | | ||
| VCC | 3.3V | | ||
| GND | GND | | ||
| SCL | C0 | | ||
| SDA | C1 | |
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 @@ | ||
## v1.2 | ||
|
||
* Lux only screen now has statistics | ||
* Settings are now stored on SD card | ||
* You can choose the resolution (BH1750 only) and address for sensor | ||
|
||
(thanks to @danielskowronski for contributing to this update) | ||
|
||
## v1.1 | ||
|
||
Added support for MAX44009 sensor (thanks to @wosk) | ||
|
||
## v1.0 | ||
|
||
Initial release for Flipper Application Catalog |
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,30 @@ | ||
#include "lightmeter_scene.h" | ||
|
||
// Generate scene on_enter handlers array | ||
#define ADD_SCENE(prefix, name, id) prefix##_scene_##name##_on_enter, | ||
void (*const lightmeter_on_enter_handlers[])(void*) = { | ||
#include "lightmeter_scene_config.h" | ||
}; | ||
#undef ADD_SCENE | ||
|
||
// Generate scene on_event handlers array | ||
#define ADD_SCENE(prefix, name, id) prefix##_scene_##name##_on_event, | ||
bool (*const lightmeter_on_event_handlers[])(void* context, SceneManagerEvent event) = { | ||
#include "lightmeter_scene_config.h" | ||
}; | ||
#undef ADD_SCENE | ||
|
||
// Generate scene on_exit handlers array | ||
#define ADD_SCENE(prefix, name, id) prefix##_scene_##name##_on_exit, | ||
void (*const lightmeter_on_exit_handlers[])(void* context) = { | ||
#include "lightmeter_scene_config.h" | ||
}; | ||
#undef ADD_SCENE | ||
|
||
// Initialize scene handlers configuration structure | ||
const SceneManagerHandlers lightmeter_scene_handlers = { | ||
.on_enter_handlers = lightmeter_on_enter_handlers, | ||
.on_event_handlers = lightmeter_on_event_handlers, | ||
.on_exit_handlers = lightmeter_on_exit_handlers, | ||
.scene_num = LightMeterAppSceneNum, | ||
}; |
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,29 @@ | ||
#pragma once | ||
|
||
#include <gui/scene_manager.h> | ||
|
||
// Generate scene id and total number | ||
#define ADD_SCENE(prefix, name, id) LightMeterAppScene##id, | ||
typedef enum { | ||
#include "lightmeter_scene_config.h" | ||
LightMeterAppSceneNum, | ||
} LightMeterAppScene; | ||
#undef ADD_SCENE | ||
|
||
extern const SceneManagerHandlers lightmeter_scene_handlers; | ||
|
||
// Generate scene on_enter handlers declaration | ||
#define ADD_SCENE(prefix, name, id) void prefix##_scene_##name##_on_enter(void*); | ||
#include "lightmeter_scene_config.h" | ||
#undef ADD_SCENE | ||
|
||
// Generate scene on_event handlers declaration | ||
#define ADD_SCENE(prefix, name, id) \ | ||
bool prefix##_scene_##name##_on_event(void* context, SceneManagerEvent event); | ||
#include "lightmeter_scene_config.h" | ||
#undef ADD_SCENE | ||
|
||
// Generate scene on_exit handlers declaration | ||
#define ADD_SCENE(prefix, name, id) void prefix##_scene_##name##_on_exit(void* context); | ||
#include "lightmeter_scene_config.h" | ||
#undef ADD_SCENE |
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,4 @@ | ||
ADD_SCENE(lightmeter, main, Main) | ||
ADD_SCENE(lightmeter, config, Config) | ||
ADD_SCENE(lightmeter, help, Help) | ||
ADD_SCENE(lightmeter, about, About) |
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,71 @@ | ||
#include "../../lightmeter.h" | ||
|
||
void lightmeter_scene_about_widget_callback(GuiButtonType result, InputType type, void* context) { | ||
LightMeterApp* app = context; | ||
|
||
UNUSED(app); | ||
UNUSED(result); | ||
UNUSED(type); | ||
if(type == InputTypeShort) { | ||
view_dispatcher_send_custom_event(app->view_dispatcher, result); | ||
} | ||
} | ||
|
||
void lightmeter_scene_about_on_enter(void* context) { | ||
LightMeterApp* app = context; | ||
|
||
FuriString* temp_str; | ||
temp_str = furi_string_alloc(); | ||
furi_string_printf(temp_str, "\e#%s\n", "Information"); | ||
|
||
furi_string_cat_printf(temp_str, "Version: %s\n", LM_VERSION_APP); | ||
furi_string_cat_printf(temp_str, "Developed by: %s\n", LM_DEVELOPED); | ||
furi_string_cat_printf(temp_str, "Github: %s\n\n", LM_GITHUB); | ||
|
||
furi_string_cat_printf(temp_str, "\e#%s\n", "Description"); | ||
furi_string_cat_printf( | ||
temp_str, | ||
"Showing suggested camera\nsettings based on ambient\nlight or flash.\n\nInspired by a lightmeter\nproject by vpominchuk\n"); | ||
|
||
widget_add_text_box_element( | ||
app->widget, | ||
0, | ||
0, | ||
128, | ||
14, | ||
AlignCenter, | ||
AlignBottom, | ||
"\e#\e! \e!\n", | ||
false); | ||
widget_add_text_box_element( | ||
app->widget, | ||
0, | ||
2, | ||
128, | ||
14, | ||
AlignCenter, | ||
AlignBottom, | ||
"\e#\e! Lightmeter \e!\n", | ||
false); | ||
widget_add_text_scroll_element(app->widget, 0, 16, 128, 50, furi_string_get_cstr(temp_str)); | ||
furi_string_free(temp_str); | ||
|
||
view_dispatcher_switch_to_view(app->view_dispatcher, LightMeterAppViewAbout); | ||
} | ||
|
||
bool lightmeter_scene_about_on_event(void* context, SceneManagerEvent event) { | ||
LightMeterApp* app = context; | ||
|
||
bool consumed = false; | ||
UNUSED(app); | ||
UNUSED(event); | ||
|
||
return consumed; | ||
} | ||
|
||
void lightmeter_scene_about_on_exit(void* context) { | ||
LightMeterApp* app = context; | ||
|
||
// Clear views | ||
widget_reset(app->widget); | ||
} |
Oops, something went wrong.