Skip to content

Commit

Permalink
Update sf2020.md
Browse files Browse the repository at this point in the history
  • Loading branch information
strayfade committed Jun 17, 2024
1 parent ef7d3d0 commit fa22887
Show file tree
Hide file tree
Showing 11 changed files with 108 additions and 57 deletions.
15 changes: 8 additions & 7 deletions Build.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
const fs = require('fs')
const Log = require('./Log').Log
const path = require('path')
const { Log, LogColors } = require('./Log')

const JSProcessorOptions = {
compact: true,
Expand Down Expand Up @@ -83,10 +84,10 @@ const PackStylesheets = async () => {
Stylesheet = new CSSProcessor(CSSProcessorOptions).minify(Stylesheet).styles;

fs.mkdir('./build', (err) => {})
let p = __dirname + '/build/production.css'
fs.writeFileSync(p, Stylesheet)
let OutputFile = path.join(__dirname, '/build/production.css')
fs.writeFileSync(OutputFile, Stylesheet)

Log('[BUILD] - Finished file: ' + p)
Log(`[BUILD] - Finished file: ${OutputFile}`, LogColors.Success)
}

const PackScripts = async () => {
Expand All @@ -105,10 +106,10 @@ const PackScripts = async () => {
Script = JSProcessor.obfuscate(Script, JSProcessorOptions).getObfuscatedCode()

fs.mkdir('./build', (err) => {})
let p = __dirname + '/build/production.js'
fs.writeFileSync(p, Script, { recursive: true })
let OutputFile = path.join(__dirname, '/build/production.js')
fs.writeFileSync(OutputFile, Script, { recursive: true })

Log('[BUILD] - Finished file: ' + p)
Log(`[BUILD] - Finished file: ${OutputFile}`, LogColors.Success)
}

PackStylesheets()
Expand Down
80 changes: 60 additions & 20 deletions Log.js
Original file line number Diff line number Diff line change
@@ -1,25 +1,65 @@
const process = require('process')
const P = (Input) => {
return Input.toString().length < 2 ? '0' + Input : Input

const ColorsForeground = Object.freeze({
Black: 30,
Red: 31,
Green: 32,
Yellow: 33,
Blue: 34,
Magenta: 35,
Cyan: 36,
White: 37,
Gray: 90
});
const ColorsBackground = Object.freeze({
Black: 40,
Red: 41,
Green: 42,
Yellow: 43,
Blue: 44,
Magenta: 45,
Cyan: 46,
White: 47,
Gray: 100
});

const LogColors = Object.freeze({
Default: {
fg: null,
bg: null
},
Warning: {
fg: ColorsForeground.Black,
bg: ColorsBackground.Yellow
},
Error: {
fg: ColorsForeground.White,
bg: ColorsBackground.Red
},
Success: {
fg: ColorsForeground.Green,
bg: null
}
});

const LogPrivate = (String, Colors = LogColors.Default) => {
const ControlCode = (Code) => {
return `\x1b[${Code}m`
}
console.log(`${Colors.fg ? ControlCode(Colors.fg) : ""}${Colors.bg ? ControlCode(Colors.bg) : ""}${Colors != LogColors.Default ? ControlCode(1) : ""}${String.toString()}${ControlCode(0)}`)
}
const Q = (Input) => {
for (let x = 0; x < 4; x++) {
if (Input.toString().length < 4) {
Input = '0' + Input

const Log = (String, Colors = LogColors.Default) => {
const GenerateTimestamp = () => {
const P = (Input, Length = 2) => {
let Output = Input.toString();
while (Output.length < Length)
Output = "0" + Output
return Output;
}
let N = new Date(Date.now());
return `${P(N.getMonth() + 1)}/${P(N.getDate())}/${P(N.getFullYear(), 4)} ${P(N.getHours() > 12 ? N.getHours() - 12 : N.getHours())}:${P(N.getMinutes())}:${P(N.getSeconds())}.${P(N.getMilliseconds(), 4)} ${N.getHours() >= 12 ? "PM" : "AM"}`
}
return Input
}
const MakeFormat = () => {
let D = new Date(Date.now())
let FormattingTag = P(D.getDay()) + '/' + P(D.getMonth()) + '/' + D.getFullYear()
FormattingTag +=
' | ' + P(D.getHours()) + ':' + P(D.getMinutes()) + ':' + P(D.getSeconds()) + '.' + Q(D.getMilliseconds())
return '[' + FormattingTag + ']'
}
const Log = (String) => {
// eslint-disable-next-line no-console
console.log(MakeFormat() + ' - ' + String.toString())
LogPrivate(`[${GenerateTimestamp()}] ${String}`, Colors)
}

module.exports = { Log }
module.exports = { ColorsForeground, ColorsBackground, LogColors, Log };
7 changes: 5 additions & 2 deletions Server.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,17 @@ const { App } = require('./App')
const { Log } = require('./Log')

const Server = http.createServer(App)
Server.listen(process.env.PORT)
if (process.argv[2])
Server.listen(process.argv[2])
else
Server.listen(process.env.PORT)

Server.on('listening', () => {
const Address = Server.address()
const Binding = typeof Address === 'string' ? `pipe ${Address}` : `port ${Address.port}`
if (Address.port < 10000) {
Log(`Listening on ${Binding}`)
Log(`Local address (if available): http://127.0.0.1:${Address.port}`)
Log(`Local address: http://127.0.0.1:${Address.port}`)
}
})

Expand Down
Binary file added assets/images/sf20401.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed assets/images/sf20401.png
Binary file not shown.
Binary file added assets/images/sf20402.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/sf20403.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/sf20404.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion components/Body.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const Body = async (Request, Inner) => {
return `
<body${(Request.cookies.lightMode == "true") ? ` style="--foreground: var(--light);--background: var(--dark);"` : ``}>
<body${(Request.cookies && Request.cookies.lightMode && (Request.cookies.lightMode == "true")) ? ` style="--foreground: var(--light);--background: var(--dark);"` : ``}>
${Inner}
<script src="/build/production.js"></script>
</body>
Expand Down
3 changes: 1 addition & 2 deletions css/PostContent.css
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
.article-content p img {
max-width: 100%;
max-height: 300px;
max-height: 500px;
margin: 0px auto;
display: block;
border-radius: 15px;
}
.image-caption {
text-align: center;
Expand Down
58 changes: 33 additions & 25 deletions posts/sf2040.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,52 +12,51 @@

> This page is a modified version of the README from the [GitHub repository](https://github.com/strayfade/sf2040), and may become outdated. For the most recent version of this page, read the [GitHub README](https://github.com/strayfade/sf2040) instead.
### About
<img src="/assets/images/sf20401.jpg">

### About
The sf2040 is a mechanical 76-key keyboard based on the [RP2040](https://datasheets.raspberrypi.com/rp2040/rp2040-datasheet.pdf) microcontroller from Raspberry Pi.

> This project has been certified by the OSHWA as open source hardware.
>
> `[OSHW] US002610 | Certified open source hardware | oshwa.org/cert`
<img src="/assets/images/sf20401.png"/>
> ```html
> [OSHW] US002610 | Certified open source hardware | oshwa.org/cert
> ```
### Features
- USB Type-C Port
- Fully open-source/open-hardware design and firmware files
- **No LED backlight**
- **No Bluetooth/wireless connectivity**
- USB Type-C Port
- Fully open-source/open-hardware design and firmware files
- **No LED backlight**
- **No Bluetooth/wireless connectivity**
### Assembly/Mechanical Information
**Required** parts:
- PCB ([Download Gerber](https://github.com/strayfade/sf2040/blob/main/pcb/Gerber/Gerber.zip))
- 3D-printed case ([Download .STEP](https://github.com/strayfade/sf2040/blob/main/case/Case.step))
- Keyboard plate ([Download .STEP](https://github.com/strayfade/sf2040/blob/main/plate/Plate.step))
- _Your choice of 76 full-size MX-style keyswitches_
- MX-style Hot Swap Switch Mounts ([Amazon](https://www.amazon.com/gp/product/B0B4W9YMGM))
- Screw-in PCB Mount Stabilizers ([Amazon](https://www.amazon.com/gp/product/B0CN38CXQ3))
- PCB
- 3D-printed case
- Keyswitch plate
- _Your choice of 76 full-size MX-style keyswitches_
- MX-style Hot Swap Switch Mounts ([Amazon](https://www.amazon.com/gp/product/B0B4W9YMGM))
- Screw-in PCB Mount Stabilizers ([Amazon](https://www.amazon.com/gp/product/B0CN38CXQ3))
**Optional, but recommended** parts:
- 0.5mm Foam Switch Dampeners ([Amazon](https://www.amazon.com/gp/product/B0B942VCMV))
- Krytox 205 Grade 0 Lubricant
- Switch disassembly tools
- Case filler (I used off-brand polyester fiber)
- 0.5mm Foam Switch Dampeners ([Amazon](https://www.amazon.com/gp/product/B0B942VCMV))
- Krytox 205 Grade 0 Lubricant
- Switch disassembly tools
- Case filler (I used polyester fiber)
### Firmware
This keyboard runs standard [QMK firmware](https://docs.qmk.fm/#/), configuration for which is included in the repository.

> The firmware can be downloaded pre-configured for this keyboard [here](https://github.com/strayfade/sf2040/raw/main/firmware/builds/sf2040.uf2).
The contents of the `firmware` folder in the repository should be copied into QMK's working keyboard directory (usually `qmk_firmware/keyboards`) before building.
This keyboard runs standard [QMK firmware](https://docs.qmk.fm/#/), configuration for which is included in this repository.
Build with support for VIA enabled:
qmk compile -kb sf2040 -km via
```sh
qmk compile -kb sf2040 -km via
```
The RP2040's bootloader can be accessed by holding the **ESC** key while plugging in the keyboard. Then, simply drag-and-drop the output `.uf2` firmware into the bootloader folder.

Expand All @@ -67,4 +66,13 @@ This keyboard has been merged into the [QMK repository](https://github.com/qmk/q
### License

The sf2040 keyboard design and firmware is released under the GPL3 license. Contributions and pull requests to the repository are always welcome!
The sf2040 keyboard design and firmware is released under the GPL3 license. Contributions and pull requests to this repository are always welcome!


<h3 style="margin: 0px auto; width: max-content; margin-top: 50px;">Gallery</h1>

<div style="width: 100%;">
<img style="width: 100%;" src="/assets/images/sf20402.jpg">
<img style="width: 100%;" src="/assets/images/sf20403.jpg">
<img style="width: 100%;" src="/assets/images/sf20404.jpg">
</div>

0 comments on commit fa22887

Please sign in to comment.