mirror of
https://github.com/eried/portapack-mayhem.git
synced 2025-03-12 09:56:30 -04:00
More SGD
This commit is contained in:
parent
b45638f9ed
commit
30b4e43794
@ -92,7 +92,7 @@ SubGhzDView::SubGhzDView(NavigationView& nav)
|
|||||||
recent_entries_view.on_select = [this](const SubGhzDRecentEntry& entry) {
|
recent_entries_view.on_select = [this](const SubGhzDRecentEntry& entry) {
|
||||||
nav_.push<SubGhzDRecentEntryDetailView>(entry);
|
nav_.push<SubGhzDRecentEntryDetailView>(entry);
|
||||||
};
|
};
|
||||||
baseband::set_weather();
|
baseband::set_subghzd(0);
|
||||||
receiver_model.enable();
|
receiver_model.enable();
|
||||||
signal_token_tick_second = rtc_time::signal_tick_second += [this]() {
|
signal_token_tick_second = rtc_time::signal_tick_second += [this]() {
|
||||||
on_tick_second();
|
on_tick_second();
|
||||||
|
@ -324,6 +324,11 @@ void set_weather() {
|
|||||||
send_message(&message);
|
send_message(&message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void set_subghzd(uint8_t modulation = 0) {
|
||||||
|
const SubGhzFPRxConfigureMessage message{modulation, 1};
|
||||||
|
send_message(&message);
|
||||||
|
}
|
||||||
|
|
||||||
static bool baseband_image_running = false;
|
static bool baseband_image_running = false;
|
||||||
|
|
||||||
void run_image(const spi_flash::image_tag_t image_tag) {
|
void run_image(const spi_flash::image_tag_t image_tag) {
|
||||||
|
@ -89,6 +89,7 @@ void set_siggen_tone(const uint32_t tone);
|
|||||||
void set_siggen_config(const uint32_t bw, const uint32_t shape, const uint32_t duration);
|
void set_siggen_config(const uint32_t bw, const uint32_t shape, const uint32_t duration);
|
||||||
void set_spectrum_painter_config(const uint16_t width, const uint16_t height, bool update, int32_t bw);
|
void set_spectrum_painter_config(const uint16_t width, const uint16_t height, bool update, int32_t bw);
|
||||||
void set_weather();
|
void set_weather();
|
||||||
|
void set_subghzd(uint8_t modulation);
|
||||||
void request_beep();
|
void request_beep();
|
||||||
|
|
||||||
void run_image(const portapack::spi_flash::image_tag_t image_tag);
|
void run_image(const portapack::spi_flash::image_tag_t image_tag);
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
#ifndef __FPROTO_GENERAL_H__
|
#ifndef __FPROTO_GENERAL_H__
|
||||||
#define __FPROTO_GENERAL_H__
|
#define __FPROTO_GENERAL_H__
|
||||||
|
|
||||||
|
// useful methods for both weather and subghzd
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
|
|
||||||
|
@ -7,6 +7,10 @@ class FProtoListGeneral {
|
|||||||
FProtoListGeneral() {}
|
FProtoListGeneral() {}
|
||||||
virtual ~FProtoListGeneral() {}
|
virtual ~FProtoListGeneral() {}
|
||||||
virtual void feed(bool level, uint32_t duration) = 0;
|
virtual void feed(bool level, uint32_t duration) = 0;
|
||||||
|
void setModulation(uint8_t modulation) { modulation_ = modulation; }
|
||||||
|
|
||||||
|
protected:
|
||||||
|
uint8_t modulation_ = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
@ -26,7 +26,7 @@ class FProtoSubGhzDBase {
|
|||||||
|
|
||||||
uint8_t getSensorType() { return sensorType; }
|
uint8_t getSensorType() { return sensorType; }
|
||||||
uint32_t getSensorId() { return id; }
|
uint32_t getSensorId() { return id; }
|
||||||
|
FPROTO_SUBGHZD_MODULATION modulation = FPM_AM; // override this, if FM
|
||||||
protected:
|
protected:
|
||||||
// Helper functions to keep it as compatible with flipper as we can, so adding new protos will be easy.
|
// Helper functions to keep it as compatible with flipper as we can, so adding new protos will be easy.
|
||||||
void subghz_protocol_blocks_add_bit(uint8_t bit) {
|
void subghz_protocol_blocks_add_bit(uint8_t bit) {
|
||||||
@ -37,7 +37,6 @@ class FProtoSubGhzDBase {
|
|||||||
// General weather data holder
|
// General weather data holder
|
||||||
uint8_t sensorType = FPS_Invalid;
|
uint8_t sensorType = FPS_Invalid;
|
||||||
uint32_t id = SD_NO_ID;
|
uint32_t id = SD_NO_ID;
|
||||||
FPROTO_SUBGHZD_MODULATION modulation = FPM_AM; // override this, if FM
|
|
||||||
|
|
||||||
// inner logic stuff, also for flipper compatibility.
|
// inner logic stuff, also for flipper compatibility.
|
||||||
SubGhzDProtocolDecoderBaseRxCallback callback = NULL;
|
SubGhzDProtocolDecoderBaseRxCallback callback = NULL;
|
||||||
|
@ -34,7 +34,7 @@ class SubGhzDProtos : public FProtoListGeneral {
|
|||||||
|
|
||||||
void feed(bool level, uint32_t duration) {
|
void feed(bool level, uint32_t duration) {
|
||||||
for (const auto& obj : protos) {
|
for (const auto& obj : protos) {
|
||||||
obj->feed(level, duration);
|
if (obj->modulation == modulation_) obj->feed(level, duration);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -59,9 +59,6 @@ void WeatherProcessor::on_message(const Message* const message) {
|
|||||||
|
|
||||||
void WeatherProcessor::configure(const SubGhzFPRxConfigureMessage& message) {
|
void WeatherProcessor::configure(const SubGhzFPRxConfigureMessage& message) {
|
||||||
(void)message;
|
(void)message;
|
||||||
|
|
||||||
modulation = message.modulation; // NIY
|
|
||||||
|
|
||||||
if (protoMode != message.protoMode) {
|
if (protoMode != message.protoMode) {
|
||||||
// change it.
|
// change it.
|
||||||
FProtoListGeneral* tmp = protoList;
|
FProtoListGeneral* tmp = protoList;
|
||||||
@ -71,6 +68,13 @@ void WeatherProcessor::configure(const SubGhzFPRxConfigureMessage& message) {
|
|||||||
if (protoMode == 0) protoList = new WeatherProtos();
|
if (protoMode == 0) protoList = new WeatherProtos();
|
||||||
if (protoMode == 1) protoList = new SubGhzDProtos();
|
if (protoMode == 1) protoList = new SubGhzDProtos();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
modulation = message.modulation; // NIY
|
||||||
|
|
||||||
|
if (protoList != NULL) {
|
||||||
|
protoList->setModulation(modulation);
|
||||||
|
}
|
||||||
|
|
||||||
configured = true;
|
configured = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user