sforkowany z mirror/meshtastic-firmware
get ttgo building again
rodzic
493d7e33c6
commit
0158fcf352
|
@ -100,7 +100,7 @@ void NodeDB::loadFromDisk()
|
|||
DEBUG_MSG("Loading saved preferences\n");
|
||||
pb_istream_t stream = {&readcb, &f, DeviceState_size};
|
||||
|
||||
scratch = DeviceState_init_zero;
|
||||
memset(&scratch, 0, sizeof(scratch));
|
||||
if (!pb_decode(&stream, DeviceState_fields, &scratch))
|
||||
{
|
||||
DEBUG_MSG("Error: can't decode protobuf %s\n", PB_GET_ERROR(&stream));
|
||||
|
|
|
@ -38,11 +38,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
|
||||
// Select which T-Beam board is being used. Only uncomment one. Note: these options now come from platformio standard build file flags
|
||||
//#ifdef ARDUINO_T_Beam
|
||||
//#define T_BEAM_V10 // AKA Rev1 (second board released)
|
||||
#define T_BEAM_V10 // AKA Rev1 (second board released)
|
||||
//#endif
|
||||
|
||||
//#ifdef ARDUINO_HELTEC_WIFI_LORA_32_V2
|
||||
#define HELTEC_LORA32
|
||||
// #define HELTEC_LORA32
|
||||
//#endif
|
||||
|
||||
// If we are using the JTAG port for debugging, some pins must be left free for that (and things like GPS have to be disabled)
|
||||
|
|
21
src/main.ino
21
src/main.ino
|
@ -390,6 +390,27 @@ void loop()
|
|||
{
|
||||
// blink the axp led
|
||||
axp.setChgLEDMode(ledon ? AXP20X_LED_LOW_LEVEL : AXP20X_LED_OFF);
|
||||
|
||||
if (pmu_irq)
|
||||
{
|
||||
pmu_irq = false;
|
||||
axp.readIRQ();
|
||||
if (axp.isChargingIRQ())
|
||||
{
|
||||
baChStatus = "Charging";
|
||||
}
|
||||
else
|
||||
{
|
||||
baChStatus = "No Charging";
|
||||
}
|
||||
if (axp.isVbusRemoveIRQ())
|
||||
{
|
||||
baChStatus = "No Charging";
|
||||
}
|
||||
// This is not a GPIO actually connected on the tbeam board
|
||||
// digitalWrite(2, !digitalRead(2));
|
||||
axp.clearIRQ();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -280,8 +280,6 @@ static void screen_print(const char *text, uint8_t x, uint8_t y, uint8_t alignme
|
|||
dispdev.drawString(x, y, text);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void screen_print(const char *text)
|
||||
{
|
||||
DEBUG_MSG("Screen: %s\n", text);
|
||||
|
@ -345,33 +343,11 @@ uint32_t screen_loop()
|
|||
if (!disp)
|
||||
return 30 * 1000;
|
||||
|
||||
#ifdef T_BEAM_V10
|
||||
if (axp192_found && pmu_irq)
|
||||
if (wakeScreen)
|
||||
{
|
||||
pmu_irq = false;
|
||||
axp.readIRQ();
|
||||
if (axp.isChargingIRQ())
|
||||
{
|
||||
baChStatus = "Charging";
|
||||
}
|
||||
else
|
||||
{
|
||||
baChStatus = "No Charging";
|
||||
}
|
||||
if (axp.isVbusRemoveIRQ())
|
||||
{
|
||||
baChStatus = "No Charging";
|
||||
}
|
||||
// This is not a GPIO actually connected on the tbeam board
|
||||
// digitalWrite(2, !digitalRead(2));
|
||||
axp.clearIRQ();
|
||||
screen_on(); // make sure the screen is not asleep
|
||||
wakeScreen = false;
|
||||
}
|
||||
#endif
|
||||
|
||||
if(wakeScreen) {
|
||||
screen_on(); // make sure the screen is not asleep
|
||||
wakeScreen = false;
|
||||
}
|
||||
|
||||
static bool showingBootScreen = true;
|
||||
|
||||
|
@ -389,33 +365,36 @@ if(wakeScreen) {
|
|||
}
|
||||
|
||||
// Show the bluetooth PIN screen
|
||||
void screen_start_bluetooth(uint32_t pin) {
|
||||
static FrameCallback btFrames[] = { drawFrameBluetooth };
|
||||
void screen_start_bluetooth(uint32_t pin)
|
||||
{
|
||||
static FrameCallback btFrames[] = {drawFrameBluetooth};
|
||||
|
||||
snprintf(btPIN, sizeof(btPIN), "%06d", pin);
|
||||
|
||||
DEBUG_MSG("showing bluetooth screen\n");
|
||||
showingBluetooth = true;
|
||||
wakeScreen = true;
|
||||
wakeScreen = true;
|
||||
|
||||
ui.disableAutoTransition(); // we now require presses
|
||||
ui.setFrames(btFrames, 1); // Just show the bluetooth frame
|
||||
ui.disableAutoTransition(); // we now require presses
|
||||
ui.setFrames(btFrames, 1); // Just show the bluetooth frame
|
||||
// we rely on our main loop to show this screen (because we are invoked deep inside of bluetooth callbacks)
|
||||
// ui.update(); // manually draw once, because I'm not sure if loop is getting called
|
||||
}
|
||||
|
||||
// restore our regular frame list
|
||||
void screen_set_frames() {
|
||||
void screen_set_frames()
|
||||
{
|
||||
DEBUG_MSG("showing standard frames\n");
|
||||
ui.setFrames(nonBootFrames, frameCount - 1);
|
||||
ui.setFrames(nonBootFrames, frameCount - 1);
|
||||
showingBluetooth = false;
|
||||
}
|
||||
|
||||
/// handle press of the button
|
||||
void screen_press() {
|
||||
void screen_press()
|
||||
{
|
||||
// screen_start_bluetooth(123456);
|
||||
|
||||
// Once the user presses a button, stop auto scrolling between screens
|
||||
ui.disableAutoTransition(); // we now require presses
|
||||
ui.disableAutoTransition(); // we now require presses
|
||||
ui.nextFrame();
|
||||
}
|
Ładowanie…
Reference in New Issue