Skip to content

Commit

Permalink
Reverted changes to examples (by default)
Browse files Browse the repository at this point in the history
  • Loading branch information
ajmcquilkin committed Mar 10, 2024
1 parent e65b8e6 commit a2bb153
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 8 deletions.
2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -54,5 +54,7 @@ serde_json = { version = "1.0", optional = true }
thiserror = "1.0.48"
uuid = "1.6.1"
btleplug = "0.11.5"

[dev-dependencies]
fern = { version = "0.6.2", features = ["colored"] }
humantime = "2.1.0"
10 changes: 6 additions & 4 deletions examples/basic_serial.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ use std::time::SystemTime;
use meshtastic::api::StreamApi;
use meshtastic::utils;

/// Set up the logger to output to the console and to a file.
/// Set up the logger to output to stdout
/// **Note:** the invokation of this function is commented out in main by default.
fn setup_logger() -> Result<(), fern::InitError> {
fern::Dispatch::new()
.format(|out, message, record| {
Expand All @@ -30,7 +31,8 @@ fn setup_logger() -> Result<(), fern::InitError> {

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
setup_logger()?;
// Uncomment this to enable logging
// setup_logger()?;

let stream_api = StreamApi::new();

Expand All @@ -54,8 +56,8 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {

// This loop can be broken with ctrl+c, or by disconnecting
// the attached serial port.
while let Some(_decoded) = decoded_listener.recv().await {
// println!("Received: {:?}", decoded);
while let Some(decoded) = decoded_listener.recv().await {
println!("Received: {:?}", decoded);
}

// Note that in this specific example, this will only be called when
Expand Down
10 changes: 6 additions & 4 deletions examples/basic_tcp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ use std::time::SystemTime;
use meshtastic::api::StreamApi;
use meshtastic::utils;

/// Set up the logger to output to the console and to a file.
/// Set up the logger to output to stdout
/// **Note:** the invokation of this function is commented out in main by default.
fn setup_logger() -> Result<(), fern::InitError> {
fern::Dispatch::new()
.format(|out, message, record| {
Expand All @@ -30,7 +31,8 @@ fn setup_logger() -> Result<(), fern::InitError> {

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
setup_logger()?;
// Uncomment this to enable logging
// setup_logger()?;

let stream_api = StreamApi::new();

Expand All @@ -51,8 +53,8 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
let stream_api = stream_api.configure(config_id).await?;

// This loop can be broken with ctrl+c, or by unpowering the radio.
while let Some(_decoded) = decoded_listener.recv().await {
// println!("Received: {:?}", decoded);
while let Some(decoded) = decoded_listener.recv().await {
println!("Received: {:?}", decoded);
}

// Note that in this specific example, this will only be called when
Expand Down

0 comments on commit a2bb153

Please sign in to comment.