Added directories for saving logs
- slightly edited .ino files - documentation added - now it will save the logs in special directories on any os
This commit is contained in:
parent
0e29f51537
commit
97d57b139b
6
.gitignore
vendored
6
.gitignore
vendored
@ -1,2 +1,8 @@
|
|||||||
2024*.txt
|
2024*.txt
|
||||||
test/*
|
test/*
|
||||||
|
|
||||||
|
serial_read/go.mod
|
||||||
|
|
||||||
|
serial_read/go.sum
|
||||||
|
|
||||||
|
*.exe
|
||||||
|
|||||||
BIN
doc/Nano.png
Normal file
BIN
doc/Nano.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 272 KiB |
BIN
doc/UnoR4Wifi.png
Normal file
BIN
doc/UnoR4Wifi.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 458 KiB |
@ -7,7 +7,7 @@ void setup() {
|
|||||||
while (!Serial)
|
while (!Serial)
|
||||||
;
|
;
|
||||||
Serial.begin(9600);
|
Serial.begin(9600);
|
||||||
Serial.println("Reciver init");
|
Serial.println("# Reciever Init");
|
||||||
radio.begin();
|
radio.begin();
|
||||||
radio.openReadingPipe(0, address); //set the address
|
radio.openReadingPipe(0, address); //set the address
|
||||||
radio.startListening(); //Set module as receiver
|
radio.startListening(); //Set module as receiver
|
||||||
@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
|
|
||||||
bool gbSenserConnectState = false;
|
bool gbSenserConnectState = false;
|
||||||
//create an RF24 object
|
//create an RF24 objetct
|
||||||
RF24 radio(9, 8); // CE, CSN
|
RF24 radio(9, 8); // CE, CSN
|
||||||
const byte address[6] = "00001"; //address through which two modules communicate
|
const byte address[6] = "00001"; //address through which two modules communicate
|
||||||
|
|
||||||
@ -24,19 +24,19 @@ void setup() {
|
|||||||
imuInit(&enMotionSensorType, &enPressureType);
|
imuInit(&enMotionSensorType, &enPressureType);
|
||||||
if(IMU_EN_SENSOR_TYPE_ICM20948 == enMotionSensorType)
|
if(IMU_EN_SENSOR_TYPE_ICM20948 == enMotionSensorType)
|
||||||
{
|
{
|
||||||
Serial.println("Motion sersor is ICM-20948");
|
Serial.println("# Motion sersor is ICM-20948");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Serial.println("Motion sersor NULL");
|
Serial.println("# Motion sersor NULL");
|
||||||
}
|
}
|
||||||
if(IMU_EN_SENSOR_TYPE_BMP280 == enPressureType)
|
if(IMU_EN_SENSOR_TYPE_BMP280 == enPressureType)
|
||||||
{
|
{
|
||||||
Serial.println("Pressure sersor is BMP280");
|
Serial.println("# Pressure sersor is BMP280");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Serial.println("Pressure sersor NULL");
|
Serial.println("# Pressure sersor NULL");
|
||||||
}
|
}
|
||||||
delay(1000);
|
delay(1000);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,7 +0,0 @@
|
|||||||
module foglar/serial_read
|
|
||||||
|
|
||||||
go 1.21.6
|
|
||||||
|
|
||||||
require github.com/tarm/serial v0.0.0-20180830185346-98f6abe2eb07
|
|
||||||
|
|
||||||
require golang.org/x/sys v0.16.0 // indirect
|
|
||||||
@ -1,4 +0,0 @@
|
|||||||
github.com/tarm/serial v0.0.0-20180830185346-98f6abe2eb07 h1:UyzmZLoiDWMRywV4DUYb9Fbt8uiOSooupjTq10vpvnU=
|
|
||||||
github.com/tarm/serial v0.0.0-20180830185346-98f6abe2eb07/go.mod h1:kDXzergiv9cbyO7IOYJZWg1U88JhDg3PB6klq9Hg2pA=
|
|
||||||
golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU=
|
|
||||||
golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
|
||||||
38
serial_read/path_unix.go
Normal file
38
serial_read/path_unix.go
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
//go:build !windows
|
||||||
|
// +build !windows
|
||||||
|
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"github.com/mitchellh/go-homedir"
|
||||||
|
"log"
|
||||||
|
"os"
|
||||||
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
|
HOME string
|
||||||
|
PATH string
|
||||||
|
)
|
||||||
|
|
||||||
|
// Check if the directory exists
|
||||||
|
func init() {
|
||||||
|
|
||||||
|
var err error
|
||||||
|
HOME, err = homedir.Dir()
|
||||||
|
if err != nil {
|
||||||
|
log.Fatal(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
PATH = HOME + "/.config/serial-monitor/"
|
||||||
|
|
||||||
|
if _, err := os.Stat(PATH); os.IsNotExist(err) {
|
||||||
|
// Directory does not exist, create it
|
||||||
|
err := os.MkdirAll(PATH, os.ModePerm)
|
||||||
|
if err != nil {
|
||||||
|
fmt.Println("Error creating directory:", err)
|
||||||
|
} else {
|
||||||
|
fmt.Println("Directory created:", PATH)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
24
serial_read/path_win.go
Normal file
24
serial_read/path_win.go
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
//go:build windows
|
||||||
|
// +build windows
|
||||||
|
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/mitchellh/go-homedir"
|
||||||
|
"log"
|
||||||
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
|
HOME string
|
||||||
|
PATH string
|
||||||
|
)
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
var err error
|
||||||
|
HOME, err = homedir.Dir()
|
||||||
|
if err != nil {
|
||||||
|
log.Fatal(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
PATH = HOME + "\\Downloads"
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue
Block a user