Skip to content

Commit

Permalink
RC1
Browse files Browse the repository at this point in the history
  • Loading branch information
solasolo committed May 25, 2022
1 parent c589b0a commit c31e40f
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 11 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
__pycache__
__pycache__
.vscode
*.csv
23 changes: 17 additions & 6 deletions Host/DataFile.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,18 @@

class DataFile:
def __init__(self):
base_path = os.path.dirname(__file__)

self.File = None
self.File = open( base_path + "/data/data.csv", "a+")
self.BasePath = os.path.dirname(__file__)


def __del__(self):
if self.File != None:
self.File.flush()
self.File.close()
self.Close()


def Write(self, data):
if self.File == None:
self.Open()

if len(data) >= 6:
for i in range(6):
if i > 0: self.File.write("\t")
Expand All @@ -24,4 +23,16 @@ def Write(self, data):
self.File.write("\n")


def Open(self):
self.File = None
self.File = open(self.BasePath + "/data/data.csv", "a+")


def Close(self):
if self.File != None:
self.File.flush()
self.File.close()

self.File = None


2 changes: 2 additions & 0 deletions Host/SensorChart.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@


from OpenGL import GLUT, GLU, GL

AxisColor = [[1, 0, 0], [0, 1, 0], [0, 0, 1]]
Expand Down
3 changes: 3 additions & 0 deletions Host/SensorProcess.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
##

from asyncio.windows_events import NULL
import socket
from PerformanceCounter import PerformanceCounter
Expand Down Expand Up @@ -41,6 +43,7 @@ def Recv(self):

except socket.timeout:
raw_data = []
self.DataFile.Close()

except Exception as e:
raw_data = []
Expand Down
9 changes: 6 additions & 3 deletions Host/tinyml.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"cells": [
{
"cell_type": "code",
"execution_count": 15,
"execution_count": 1,
"id": "5b90960c",
"metadata": {},
"outputs": [],
Expand Down Expand Up @@ -256,8 +256,11 @@
}
],
"metadata": {
"interpreter": {
"hash": "065a7fd65857af9b0d7d7760ab62099efda22ea2fccd7cdd83105fb1a789eaf5"
},
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"display_name": "Python 3.7.13 64-bit ('tinyml': conda)",
"language": "python",
"name": "python3"
},
Expand All @@ -271,7 +274,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.11"
"version": "3.7.13"
}
},
"nbformat": 4,
Expand Down
2 changes: 1 addition & 1 deletion predict_gesture/predict_gesture.ino
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

const int BUTTOM_PIN = 4;

const char* AP_SSID = "iCheng-choy";
const char* AP_SSID = "iCheng";
const char* AP_PWD = "nopassword";

const char* GESTURES[] = {
Expand Down

0 comments on commit c31e40f

Please sign in to comment.