-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #58 from AllenShintani/master
CI bug fixed
- Loading branch information
Showing
80 changed files
with
376 additions
and
161 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
name: Deploy | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
deploy: | ||
name: Deploy | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: lts | ||
- run: npm run build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
name: Test | ||
|
||
on: push | ||
|
||
jobs: | ||
test: | ||
name: Test | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: setup Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: lts | ||
- run: npm install | ||
- run: npm run lint | ||
- run: npm run typecheck |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
# How to contribute to the project | ||
|
||
This project welcomes any change, improvement, or suggestion! | ||
|
||
If you'd like to help its development feel free to open a new issue and raise a pull request. | ||
|
||
## IMPORTANT | ||
|
||
If you'd like to work on an existing issue, kindly **ask** for it to be assigned to you. | ||
|
||
Do you have any struggles with the issue you are working on? Feel free to **tag [me](https://github.com/AllenShintani)** in it _and/or_ open a draft pull request. Please add the appropriate labels to the issues. It's not necessary if an appropriate label does not exist. | ||
|
||
We will collaborate with users and contributors to develop the necessary features, devices, etc. This OSS will be developed in a scrum style. We appreciate and respect all contributors and users. | ||
|
||
### How do I make a contribution | ||
|
||
If you've never made an open source contribution before or are curious about how contributions operate in our project? Here's a quick rundown! | ||
|
||
#### Fork this repository | ||
|
||
Fork this repository by clicking on the fork button on the top of [this](https://github.com/AllenShintani/Edison) page. | ||
This will create a copy of this repository in your account `<your-GitHub-username>/<repository-name>`. | ||
|
||
#### Clone the repository | ||
|
||
Now clone the forked repository to your machine. Go to your GitHub account, open the forked repository, and copy the link provided under `HTTPS` when you click on the green button labeled `code` on the repository page | ||
|
||
Open a terminal and run the following git command: | ||
|
||
``` | ||
git clone "url you just copied" | ||
``` | ||
|
||
where "URL you just copied" (without quotation marks) is the URL to this repository (your fork of this project). | ||
|
||
For example: | ||
|
||
``` | ||
git clone https://github.com/AllenShintani/Edison.git | ||
``` | ||
|
||
#### Create a new branch for your changes or fix | ||
|
||
```sh | ||
$ git checkout -b <branch-name> | ||
``` | ||
|
||
#### Setup the project in your local by following the steps listed in the [README.md](https://github.com/AllenShintani/Edison/blob/master/README.md) file | ||
|
||
#### Open the project in a code editor and begin working on it | ||
#### Add the contents of the changed files to the "snapshot" git uses to manage the state of the project, also known as the index | ||
|
||
```sh | ||
$ git add . | ||
``` | ||
|
||
#### Add a descriptive commit message | ||
|
||
```sh | ||
$ git commit -m "Insert a short message of the changes made here" | ||
``` | ||
|
||
#### Push the changes to the remote repository | ||
|
||
```sh | ||
$ git push -u origin <branch-name> | ||
``` | ||
|
||
#### Submit a pull request to the upstream repository |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +0,0 @@ | ||
import { Led } from "./src/types/LED"; | ||
import { Sensor } from "./src/types/Sensor"; | ||
import { ServoMotor } from "./src/types/ServoMotor"; | ||
|
||
// write here all pin mode | ||
export type Output = Led | Sensor | ||
export type Servo = ServoMotor | ||
|
||
export type Mode = 'Servo' | 'Output' | 'Input' | 'Pwm' ; | ||
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// // board.test.ts | ||
// import { describe, it, expect, vi } from 'vitest' | ||
// import type { SerialPort } from 'serialport' | ||
// import { board } from '../../utils/board' | ||
// import { findArduinoPath } from '../../utils/findArduinoPath' | ||
|
||
// // SerialPort と findArduinoPath のモック | ||
// vi.mock('serialport', () => ({ | ||
// SerialPort: vi.fn().mockImplementation(() => ({ | ||
// on: vi.fn((event, callback) => { | ||
// if (event === 'data') { | ||
// // 'data' イベントのモック処理 | ||
// setTimeout(() => callback('some data'), 0) | ||
// } | ||
// }), | ||
// // 他の必要なメソッドもモック化 | ||
// })), | ||
// })) | ||
|
||
// vi.mock('../../utils/findArduinoPath', () => ({ | ||
// findArduinoPath: vi.fn().mockResolvedValue('/dev/ttyUSB0'), | ||
// })) | ||
|
||
// describe('board module', () => { | ||
// it('should emit "ready" when Arduino is connected', async () => { | ||
// ;(findArduinoPath as vi.Mock).mockResolvedValue('/dev/ttyUSB0') | ||
// const mockSerialPortInstance = new SerialPort({ | ||
// path: '/dev/ttyUSB0', | ||
// baudRate: 57600, | ||
// }) | ||
// const readyListener = vi.fn() | ||
// board.on('ready', readyListener) | ||
// await board.connectAutomatic() | ||
// expect(readyListener).toHaveBeenCalled() | ||
// }) | ||
// }) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import { outputPort } from '../output/outputPort' | ||
import { inputPort } from '../input/inputPort' | ||
import { delay } from '../../index' | ||
import type { SerialPort } from '../../index' | ||
import type { Sensor } from '../../types/analog/analog' | ||
|
||
export const attachUltrasonicSensor = ( | ||
port: SerialPort, | ||
trigPin: number, | ||
echoPin: number, | ||
) => { | ||
const trig = outputPort(port)(trigPin) | ||
const echo = inputPort(port)(echoPin) | ||
|
||
return { | ||
measure: async ( | ||
method: Sensor, | ||
func: () => Promise<void> | Promise<number> | void | number, | ||
): Promise<void> => { | ||
// echo.readを一度だけ呼び出し | ||
await echo.read(method, async () => { | ||
await func() | ||
}) | ||
|
||
// 無限ループでTrigのon/offのみを繰り返す | ||
while (true) { | ||
//console.log('Trig') | ||
await trig.on() // TrigピンをHIGHにする | ||
await delay(20) | ||
await trig.off() // TrigピンをLOWにする | ||
await delay(20) // 次の測定までの待機時間 | ||
} | ||
}, | ||
} | ||
} |
Oops, something went wrong.