Skip to content

Bugfix/saving #110

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Apr 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions preload.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ const Serial = {
execFile: async (path) => {
return board.execfile(path)
},
get_prompt: async () => {
getPrompt: async () => {
return board.get_prompt()
},
keyboard_interrupt: async () => {
keyboardInterrupt: async () => {
await board.stop()
return Promise.resolve()
},
Expand Down
2 changes: 0 additions & 2 deletions ui/arduino/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@
<!-- Elements -->
<script type="text/javascript" src="views/components/elements/button.js" charset="utf-8"></script>
<script type="text/javascript" src="views/components/elements/editor.js" charset="utf-8"></script>
<script type="text/javascript" src="views/components/elements/message.js" charset="utf-8"></script>
<script type="text/javascript" src="views/components/elements/options.js" charset="utf-8"></script>
<script type="text/javascript" src="views/components/elements/tab.js" charset="utf-8"></script>
<script type="text/javascript" src="views/components/elements/terminal.js" charset="utf-8"></script>

Expand Down
17 changes: 10 additions & 7 deletions ui/arduino/store.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ async function store(state, emitter) {

// Stop whatever is going on
// Recover from getting stuck in raw repl
await serial.get_prompt()
await serial.getPrompt()

// Make sure there is a lib folder
log('creating lib folder')
Expand Down Expand Up @@ -174,7 +174,7 @@ async function store(state, emitter) {
emitter.emit('open-panel')
emitter.emit('render')
try {
await serial.get_prompt()
await serial.getPrompt()
await serial.run(code)
} catch(e) {
log('error', e)
Expand All @@ -187,7 +187,7 @@ async function store(state, emitter) {
}
emitter.emit('open-panel')
emitter.emit('render')
await serial.get_prompt()
await serial.getPrompt()
})
emitter.on('reset', async () => {
log('reset')
Expand Down Expand Up @@ -272,6 +272,7 @@ async function store(state, emitter) {
// Check if the current full path exists
let fullPathExists = false
if (openFile.source == 'board') {
await serial.getPrompt()
fullPathExists = await serial.fileExists(
serial.getFullPath(
state.boardNavigationRoot,
Expand All @@ -294,6 +295,7 @@ async function store(state, emitter) {
if (openFile.source == 'board') {
openFile.parentFolder = state.boardNavigationPath
// Check for overwrite
await serial.getPrompt()
willOverwrite = await serial.fileExists(
serial.getFullPath(
state.boardNavigationRoot,
Expand Down Expand Up @@ -328,7 +330,7 @@ async function store(state, emitter) {
const contents = openFile.editor.editor.state.doc.toString()
try {
if (openFile.source == 'board') {
await serial.get_prompt()
await serial.getPrompt()
await serial.saveFileContent(
serial.getFullPath(
state.boardNavigationRoot,
Expand Down Expand Up @@ -918,7 +920,7 @@ async function store(state, emitter) {
const contents = openFile.editor.editor.state.doc.toString()
try {
if (openFile.source == 'board') {
await serial.get_prompt()
await serial.getPrompt()
await serial.saveFileContent(
serial.getFullPath(
state.boardNavigationRoot,
Expand Down Expand Up @@ -981,7 +983,7 @@ async function store(state, emitter) {
const contents = openFile.editor.editor.state.doc.toString()
try {
if (openFile.source == 'board') {
await serial.get_prompt()
await serial.getPrompt()
await serial.saveFileContent(
serial.getFullPath(
state.boardNavigationRoot,
Expand Down Expand Up @@ -1382,7 +1384,7 @@ async function getAvailablePorts() {
}

async function getBoardFiles(path) {
await serial.get_prompt()
await serial.getPrompt()
let files = await serial.ilistFiles(path)
files = files.map(f => ({
fileName: f[0],
Expand All @@ -1401,6 +1403,7 @@ function checkDiskFile({ root, parentFolder, fileName }) {

async function checkBoardFile({ root, parentFolder, fileName }) {
if (root == null || parentFolder == null || fileName == null) return false
await serial.getPrompt()
return serial.fileExists(
serial.getFullPath(root, parentFolder, fileName)
)
Expand Down
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy